From 04420b7a3bd96f866a8f554c104a387738f1a69f Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Wed, 9 Dec 2020 06:55:42 +0300 Subject: [PATCH] fixed an issue with running ig from outside of the project dir... Signed-off-by: Alex A. Naanou --- Viewer/cfg/requirejs.js | 4 ++++ Viewer/features/cli.js | 11 +++++++++-- Viewer/features/sharp.js | 2 +- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Viewer/cfg/requirejs.js b/Viewer/cfg/requirejs.js index 74c091b0..f2a6b3c5 100644 --- a/Viewer/cfg/requirejs.js +++ b/Viewer/cfg/requirejs.js @@ -12,6 +12,10 @@ var requirejs_cfg = { document.baseURI .replace(/^[a-zA-Z]+:\/\/\/?/, '') .split(/[#&]/)[0].split(/[\\\/]/g).slice(0, -1).join('/') + // node... + : typeof(process) != 'undefined' ? + process.argv[1].split(/[\\\/]/g).slice(0, -1).join('/') + // everything else... : './', // XXX this does not work on direct filesystem access... diff --git a/Viewer/features/cli.js b/Viewer/features/cli.js index e11e873a..08c0b16e 100755 --- a/Viewer/features/cli.js +++ b/Viewer/features/cli.js @@ -209,13 +209,18 @@ var CLIActions = actions.Actions({ function(){ // XXX }], + // XXX + startWorker: ['- System/Start as worker', + {cli: '-worker'}, + function(){ + // XXX + }], // XXX metadata caching and preview creation are not in sync, can // this be a problem??? // ...if not, add a note... // XXX should we support creating multiple indexes at the same time??? // XXX this is reletively generic, might be useful globally... - // XXX add support for cwd and relative paths... // XXX should we use a clean index or do this in-place??? makeIndex: ['- System/Make index', {cli: { @@ -225,7 +230,9 @@ var CLIActions = actions.Actions({ }}, function(path){ var that = this - path = util.normalizePath(path) + + path = util.normalizePath( + pathlib.resolve(process.cwd(), path)) // XXX should we use a clean index or do this in-place??? //var index = this.constructor(..) diff --git a/Viewer/features/sharp.js b/Viewer/features/sharp.js index 1f6a6de8..e01e9c42 100755 --- a/Viewer/features/sharp.js +++ b/Viewer/features/sharp.js @@ -501,7 +501,7 @@ var SharpActions = actions.Actions({ return [gid, size, name] }, function(err){ // XXX error - logger && logger.emit('skipped', gid) + //logger && logger.emit('skipped', gid) }) })) })], // XXX add support for offloading the processing to a thread/worker...