Fixed error when creating directory fails
Signed-off-by: James Ketrenos <james_git@ketrenos.com>
This commit is contained in:
parent
c05f1ab8e5
commit
8fc358474d
@ -175,10 +175,13 @@ const { spawn } = require('child_process');
|
|||||||
const sharp = require("sharp"), exif = require("exif-reader");
|
const sharp = require("sharp"), exif = require("exif-reader");
|
||||||
|
|
||||||
function mkdirPromise(path) {
|
function mkdirPromise(path) {
|
||||||
|
if (path.indexOf(picturesPath) != 0) {
|
||||||
|
path = picturesPath + path;
|
||||||
|
}
|
||||||
return new Promise(function(resolve, reject) {
|
return new Promise(function(resolve, reject) {
|
||||||
fs.stat(path, function(err, stats) {
|
fs.stat(path, function(err) {
|
||||||
if (err && err.code != 'ENOENT') {
|
if (err && err.code != 'ENOENT') {
|
||||||
console.warn("Could not stat " + path + "/raw");
|
console.warn("Could not stat " + path);
|
||||||
return reject();
|
return reject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,7 +191,7 @@ function mkdirPromise(path) {
|
|||||||
|
|
||||||
fs.mkdir(path, function(err) {
|
fs.mkdir(path, function(err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return reject("Unable to create " + path, err);
|
return reject("Unable to create " + path + "\n" + err);
|
||||||
}
|
}
|
||||||
return resolve();
|
return resolve();
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user