Working on path re-creation

Signed-off-by: James Ketrenos <james_git@ketrenos.com>
This commit is contained in:
James Ketr 2018-09-26 16:00:37 -07:00
parent ae839e440b
commit caa0f104d4

View File

@ -47,10 +47,13 @@ let processRunning = false;
const { spawn } = require('child_process');
const sharp = require("sharp"), exif = require("exif-reader");
const stat = function (path) {
if (path.indexOf(picturesPath) != 0) {
path = picturesPath + path;
const stat = function (_path) {
if (_path.indexOf(picturesPath.replace(/\/$/, "")) == 0) {
_path = _path.substring(picturesPath.length);
}
let path = picturesPath + _path;
return new Promise(function (resolve, reject) {
fs.stat(path, function (error, stats) {
if (error) {
@ -68,7 +71,6 @@ const mkdir = function (_path) {
let parts = _path.split("/"), path;
console.log(parts, _path);
parts.unshift(picturesPath);
return Promise.mapSeries(parts, function (part) {
@ -77,6 +79,7 @@ const mkdir = function (_path) {
} else {
path += "/" + part;
}
return stat(path).catch(function (error) {
if (error.code != "ENOENT") {
throw error;
@ -280,7 +283,7 @@ function processBlock(items) {
asset.taken = asset.modified = date;
}
let dst = picturesPath + path + "thumbs/" + file;
let dst = picturesPath + path + "thumbs/scaled/" + file;
return exists(dst).then(function(exist) {
if (exist) {