Working on path re-creation
Signed-off-by: James Ketrenos <james_git@ketrenos.com>
This commit is contained in:
parent
ae839e440b
commit
caa0f104d4
@ -47,10 +47,13 @@ let processRunning = false;
|
|||||||
const { spawn } = require('child_process');
|
const { spawn } = require('child_process');
|
||||||
|
|
||||||
const sharp = require("sharp"), exif = require("exif-reader");
|
const sharp = require("sharp"), exif = require("exif-reader");
|
||||||
const stat = function (path) {
|
const stat = function (_path) {
|
||||||
if (path.indexOf(picturesPath) != 0) {
|
if (_path.indexOf(picturesPath.replace(/\/$/, "")) == 0) {
|
||||||
path = picturesPath + path;
|
_path = _path.substring(picturesPath.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let path = picturesPath + _path;
|
||||||
|
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
fs.stat(path, function (error, stats) {
|
fs.stat(path, function (error, stats) {
|
||||||
if (error) {
|
if (error) {
|
||||||
@ -68,8 +71,7 @@ const mkdir = function (_path) {
|
|||||||
|
|
||||||
let parts = _path.split("/"), path;
|
let parts = _path.split("/"), path;
|
||||||
|
|
||||||
console.log(parts, _path);
|
|
||||||
|
|
||||||
parts.unshift(picturesPath);
|
parts.unshift(picturesPath);
|
||||||
return Promise.mapSeries(parts, function (part) {
|
return Promise.mapSeries(parts, function (part) {
|
||||||
if (!path) {
|
if (!path) {
|
||||||
@ -77,6 +79,7 @@ const mkdir = function (_path) {
|
|||||||
} else {
|
} else {
|
||||||
path += "/" + part;
|
path += "/" + part;
|
||||||
}
|
}
|
||||||
|
|
||||||
return stat(path).catch(function (error) {
|
return stat(path).catch(function (error) {
|
||||||
if (error.code != "ENOENT") {
|
if (error.code != "ENOENT") {
|
||||||
throw error;
|
throw error;
|
||||||
@ -280,7 +283,7 @@ function processBlock(items) {
|
|||||||
asset.taken = asset.modified = date;
|
asset.taken = asset.modified = date;
|
||||||
}
|
}
|
||||||
|
|
||||||
let dst = picturesPath + path + "thumbs/" + file;
|
let dst = picturesPath + path + "thumbs/scaled/" + file;
|
||||||
|
|
||||||
return exists(dst).then(function(exist) {
|
return exists(dst).then(function(exist) {
|
||||||
if (exist) {
|
if (exist) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user