Added/fixed mkdtemp method (issue 441)
This commit is contained in:
parent
ec2b56893e
commit
67ea230e07
|
@ -1687,19 +1687,19 @@ function mkdtemp(fs, context, prefix, options, callback) {
|
||||||
return 'xxxxxx'.replace(/[xy]/g, function(c) {
|
return 'xxxxxx'.replace(/[xy]/g, function(c) {
|
||||||
var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
|
var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
|
||||||
return v.toString(16);
|
return v.toString(16);
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
if (prefix) {
|
if (prefix) {
|
||||||
var path = "/"+prefix+generateRandom();
|
var path = '/'+prefix+generateRandom();
|
||||||
make_directory(context, path, function(error) {
|
make_directory(context, path, function(error) {
|
||||||
if (error) {
|
if (error) {
|
||||||
callback(error, path)
|
callback(error, path);
|
||||||
} else {
|
} else {
|
||||||
callback(null, path);
|
callback(null, path);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
callback(new Error('filename prefix is required'), prefix)
|
callback(new Error('filename prefix is required'), prefix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue