started work on windws attributes (does not work in nw yet) and some refactoring...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2016-06-05 17:39:19 +03:00
parent 5a4525f86e
commit 9618ffeab5
3 changed files with 43 additions and 13 deletions

View File

@ -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

View File

@ -18,6 +18,7 @@ if(typeof(process) != 'undefined'){
var guaranteeEvents = requirejs('guarantee-events')
} else {
return module
}

View File

@ -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 ."