-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
main.paths creation order #50
Comments
@jaumard another solution is implement this https://github.com/substack/node-mkdirp and make a mkdirp.sync it the same but create a parents directories if dont exist. |
@catrielmuller it will be a better solution ^^ but the main team want to keep trails deps to the minimum. That's why I didn't put this solution. Thoughts @trailsjs/maintainers ? |
@jaumard if clone the function inside of the project? mkdirP.sync = function sync (p, opts, made) {
if (!opts || typeof opts !== 'object') {
opts = { mode: opts };
}
var mode = opts.mode;
var xfs = opts.fs || fs;
if (mode === undefined) {
mode = _0777 & (~process.umask());
}
if (!made) made = null;
p = path.resolve(p);
try {
xfs.mkdirSync(p, mode);
made = made || p;
}
catch (err0) {
switch (err0.code) {
case 'ENOENT' :
made = sync(path.dirname(p), opts, made);
sync(p, opts, made);
break;
// In the case of any other error, just see if there's a dir
// there already. If so, then hooray! If not, then something
// is borked.
default:
var stat;
try {
stat = xfs.statSync(p);
}
catch (err1) {
throw err0;
}
if (!stat.isDirectory()) throw err0;
break;
}
}
return made;
}; |
When the
temp
folder is not given by the user, it was added by this repo. But it was create afterconfig.main.paths
values. https://github.com/trailsjs/trailpack-core/blob/master/index.js#L47That's mean if I have :
This will crash because
core
try to first createwww
path and thentemp
path so aError: ENOENT: no such file or directory, mkdir '/.tmp/public'
But if now I change and set this :
All is working because
temp
is create beforewww
.My opinion is if
temp
,socket
andlog
are added bycore
so they have to be create first.The text was updated successfully, but these errors were encountered: