mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 18:30:09 +00:00
minor cleanup...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
4f7156c8a9
commit
74924936ba
@ -798,6 +798,7 @@ var FileSystemWriterActions = actions.Actions({
|
|||||||
|
|
||||||
// Export current state as a full loadable index
|
// Export current state as a full loadable index
|
||||||
//
|
//
|
||||||
|
// XXX resolve env variables in path...
|
||||||
// XXX what sould happen if no path is given???
|
// XXX what sould happen if no path is given???
|
||||||
// XXX should this return a promise??? ...a clean promise???
|
// XXX should this return a promise??? ...a clean promise???
|
||||||
// XXX add preview selection...
|
// XXX add preview selection...
|
||||||
@ -810,6 +811,9 @@ var FileSystemWriterActions = actions.Actions({
|
|||||||
// XXX is this correct???
|
// XXX is this correct???
|
||||||
path = path || './exported'
|
path = path || './exported'
|
||||||
|
|
||||||
|
// XXX resolve env variables in path...
|
||||||
|
// XXX
|
||||||
|
|
||||||
// resolve relative paths...
|
// resolve relative paths...
|
||||||
if(/^(\.\.?[\\\/]|[^\\\/])/.test(path)
|
if(/^(\.\.?[\\\/]|[^\\\/])/.test(path)
|
||||||
// and skip windows drives...
|
// and skip windows drives...
|
||||||
@ -874,20 +878,17 @@ var FileSystemWriterActions = actions.Actions({
|
|||||||
// XXX
|
// XXX
|
||||||
ensureDir(pathlib.dirname(to))
|
ensureDir(pathlib.dirname(to))
|
||||||
.catch(function(err){
|
.catch(function(err){
|
||||||
logger && logger.emit('error', err)
|
logger && logger.emit('error', err) })
|
||||||
})
|
|
||||||
.then(function(){
|
.then(function(){
|
||||||
return copy(from, to)
|
return copy(from, to)
|
||||||
// XXX do we need to have both of this
|
// XXX do we need to have both of this
|
||||||
// and the above .catch(..) or can
|
// and the above .catch(..) or can
|
||||||
// we just use the one above (after
|
// we just use the one above (after
|
||||||
// .then(..))
|
// .then(..))
|
||||||
.catch(function(err){
|
|
||||||
logger && logger.emit('error', err)
|
|
||||||
})
|
|
||||||
.then(function(){
|
.then(function(){
|
||||||
logger && logger.emit('done', to)
|
logger && logger.emit('done', to) })
|
||||||
})
|
.catch(function(err){
|
||||||
|
logger && logger.emit('error', err) })
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -903,6 +904,7 @@ var FileSystemWriterActions = actions.Actions({
|
|||||||
}],
|
}],
|
||||||
|
|
||||||
// XXX might also be good to save/load the export options to .ImageGrid-export.json
|
// XXX might also be good to save/load the export options to .ImageGrid-export.json
|
||||||
|
// XXX resolve env variables in path...
|
||||||
// XXX make custom previews...
|
// XXX make custom previews...
|
||||||
// ...should this be a function of .images.getBestPreview(..)???
|
// ...should this be a function of .images.getBestPreview(..)???
|
||||||
exportDirs: ['File/Export as nested directories',
|
exportDirs: ['File/Export as nested directories',
|
||||||
@ -911,6 +913,9 @@ var FileSystemWriterActions = actions.Actions({
|
|||||||
var that = this
|
var that = this
|
||||||
var base_dir = this.location.path
|
var base_dir = this.location.path
|
||||||
|
|
||||||
|
// XXX resolve env variables in path...
|
||||||
|
// XXX
|
||||||
|
|
||||||
// resolve relative paths...
|
// resolve relative paths...
|
||||||
if(/^(\.\.?[\\\/]|[^\\\/])/.test(path)
|
if(/^(\.\.?[\\\/]|[^\\\/])/.test(path)
|
||||||
// and skip windows drives...
|
// and skip windows drives...
|
||||||
@ -937,8 +942,7 @@ var FileSystemWriterActions = actions.Actions({
|
|||||||
|
|
||||||
ensureDir(pathlib.dirname(img_dir))
|
ensureDir(pathlib.dirname(img_dir))
|
||||||
.catch(function(err){
|
.catch(function(err){
|
||||||
logger && logger.emit('error', err)
|
logger && logger.emit('error', err) })
|
||||||
})
|
|
||||||
.then(function(){
|
.then(function(){
|
||||||
that.data.ribbons[ribbon].forEach(function(gid){
|
that.data.ribbons[ribbon].forEach(function(gid){
|
||||||
var img = that.images[gid]
|
var img = that.images[gid]
|
||||||
@ -954,6 +958,7 @@ var FileSystemWriterActions = actions.Actions({
|
|||||||
// XXX might be a good idea to connect this to the info framework...
|
// XXX might be a good idea to connect this to the info framework...
|
||||||
var ext = pathlib.extname(img.name)
|
var ext = pathlib.extname(img.name)
|
||||||
var tags = that.data.getTags(gid)
|
var tags = that.data.getTags(gid)
|
||||||
|
|
||||||
var name = pattern
|
var name = pattern
|
||||||
// file name...
|
// file name...
|
||||||
.replace(/%f/, img.name)
|
.replace(/%f/, img.name)
|
||||||
@ -978,13 +983,11 @@ var FileSystemWriterActions = actions.Actions({
|
|||||||
|
|
||||||
var to = img_dir +'/'+ name
|
var to = img_dir +'/'+ name
|
||||||
|
|
||||||
copy(from, to)
|
return copy(from, to)
|
||||||
.catch(function(err){
|
|
||||||
logger && logger.emit('error', err)
|
|
||||||
})
|
|
||||||
.then(function(){
|
.then(function(){
|
||||||
logger && logger.emit('done', to)
|
logger && logger.emit('done', to) })
|
||||||
})
|
.catch(function(err){
|
||||||
|
logger && logger.emit('error', err) })
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user