From 9618ffeab5c8418243c82e2b188e02a9bb976eb6 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sun, 5 Jun 2016 17:39:19 +0300 Subject: [PATCH] started work on windws attributes (does not work in nw yet) and some refactoring... Signed-off-by: Alex A. Naanou --- ui (gen4)/features/filesystem.js | 44 +++++++++++++++++++++++++------- ui (gen4)/imagegrid/file.js | 1 + ui (gen4)/package.json | 11 +++++--- 3 files changed, 43 insertions(+), 13 deletions(-) diff --git a/ui (gen4)/features/filesystem.js b/ui (gen4)/features/filesystem.js index fea6540d..b58d8a8a 100755 --- a/ui (gen4)/features/filesystem.js +++ b/ui (gen4)/features/filesystem.js @@ -15,6 +15,13 @@ if(typeof(process) != 'undefined'){ var pathlib = requirejs('path') var glob = requirejs('glob') + // Windows specific stuff... + try{ + var fswin = requirejs('fswin') + }catch(err){ + var fswin = null + } + var file = require('imagegrid/file') } @@ -1432,14 +1439,21 @@ var FileSystemWriterActions = actions.Actions({ var location = this.location var index = this.prepareIndexForWrite() + var full_path = path +'/'+ this.config['index-dir'] + return file.writeIndex( index.prepared, // XXX should we check if index dir is present in path??? //path, - path +'/'+ this.config['index-dir'], + full_path, index.date, this.config['index-filename-template'], logger) + .then(function(){ + fswin && fswin.setAttributeSync(full_path, { + IS_HIDDEN: true, + }) + }) .then(function(){ location.method = 'loadIndex' location.from = index.date @@ -1529,6 +1543,8 @@ var FileSystemWriterActions = actions.Actions({ // need for a base path... delete img.base_path + var queue = [] + // XXX copy img.path -- the main image, especially when no previews present.... // XXX @@ -1549,7 +1565,7 @@ var FileSystemWriterActions = actions.Actions({ // ...needs testing, if node's fs queues the io // internally then we do not need to bother... // XXX - ensureDir(pathlib.dirname(to)) + queue.push(ensureDir(pathlib.dirname(to)) .catch(function(err){ logger && logger.emit('error', err) }) .then(function(){ @@ -1562,19 +1578,29 @@ var FileSystemWriterActions = actions.Actions({ logger && logger.emit('done', to) }) .catch(function(err){ logger && logger.emit('error', err) }) - }) + })) }) } }) // NOTE: if we are to use .saveIndex(..) here, do not forget // to reset .changes - file.writeIndex( - this.prepareIndexForWrite(json, true).prepared, - index_path, - this.config['index-filename-template'], - logger || this.logger) - + queue.push(file.writeIndex( + this.prepareIndexForWrite(json, true).prepared, + index_path, + this.config['index-filename-template'], + logger || this.logger) + .then(function(){ + fswin && fswin.setAttributeSync(index_path, { + IS_HIDDEN: true, + }) + })) + + + return Promise.all(queue) + .then(function(){ + return that.location + }) }], // XXX might also be good to save/load the export options to .ImageGrid-export.json diff --git a/ui (gen4)/imagegrid/file.js b/ui (gen4)/imagegrid/file.js index 938c1933..08bebe32 100755 --- a/ui (gen4)/imagegrid/file.js +++ b/ui (gen4)/imagegrid/file.js @@ -18,6 +18,7 @@ if(typeof(process) != 'undefined'){ var guaranteeEvents = requirejs('guarantee-events') + } else { return module } diff --git a/ui (gen4)/package.json b/ui (gen4)/package.json index 66063b29..406d6fd0 100755 --- a/ui (gen4)/package.json +++ b/ui (gen4)/package.json @@ -2,6 +2,8 @@ "name": "ImageGrid.Viewer.g4", "main": "index.html", "version": "4.0.0a", + "preferGlobal": true, + "chromium-args": "--disable-gpu-compositing", "window": { "title": "ImageGrid.Viewer (gen4)", "position": "center", @@ -13,7 +15,6 @@ "toolbar": false, "show": false }, - "chromium-args": "--disable-gpu-compositing", "dependencies": { "app-module-path": "^1.0.6", "commander": "^2.9.0", @@ -27,15 +28,17 @@ "requirejs": "^2.1.23", "sharp": "^0.12.0" }, - "preferGlobal": true, - "bin": { - "ig": "ig.js" + "optionalDependencies": { + "fswin": "*" }, "devDependencies": { "less": "*", "webdriverio": "^4.0.4", "nwjs": "*" }, + "bin": { + "ig": "ig.js" + }, "scripts": { "build-css": "lessc css/layout.less css/layout.css", "start": "nw ."