diff --git a/ui/compatibility.js b/ui/compatibility.js
index 6101d170..69235818 100755
--- a/ui/compatibility.js
+++ b/ui/compatibility.js
@@ -44,6 +44,7 @@ if(window.CEF_dumpJSON != null){
// XXX make this work across fs...
// XXX this will not overwrite...
window.copyFile = function(src, dst){
+ var deferred = $.Deferred()
if(fp.test(src)){
// XXX will this work on Mac???
src = src.replace(fp, '')
@@ -58,7 +59,7 @@ if(window.CEF_dumpJSON != null){
path = path.join('/')
- // XXX make dirs...
+ // make dirs...
if(!fs.existsSync(path)){
console.log('making:', path)
fse.mkdirRecursiveSync(path)
@@ -66,8 +67,17 @@ if(window.CEF_dumpJSON != null){
if(!fs.existsSync(dst)){
// NOTE: this is not sync...
- return fse.copy(src, dst)
+ fse.copy(src, dst, function(err){
+ if(err){
+ deferred.reject(err)
+ } else {
+ deferred.resolve()
+ }
+ })
+ return deferred
}
+ deferred.notify(dst, 'exists')
+ return deferred.resolve()
}
window.dumpJSON = function(path, data){
if(fp.test(path)){
diff --git a/ui/files.js b/ui/files.js
index 9dc5e45d..85cbe515 100755
--- a/ui/files.js
+++ b/ui/files.js
@@ -563,6 +563,9 @@ function exportTo(path, im_name, dir_name, size){
dir_name = dir_name == null ? 'fav' : dir_name
size = size == null ? 1000 : size
+ // starting point...
+ //var deferred = $.Deferred().resolve()
+
var base_path = path
path = normalizePath(path)
diff --git a/ui/ui.js b/ui/ui.js
index 887cf5f2..ce86744c 100755
--- a/ui/ui.js
+++ b/ui/ui.js
@@ -718,16 +718,28 @@ function exportPreviewsDialog(state, dfl){
updateStatus('Export...').show()
- formDialog(null, 'Export source: '+ state +'.', {
- 'Image name pattern | %f - full filename \n%n - filename \n%e - extension \n%gid - log gid \n%g - short gid \n%i - order': '%f',
- 'Fav directory name': 'fav',
- 'Destination': {ndir: dfl},
- }, 'OK', 'exportPreviewsDialog')
+ // NOTE: we are not defining the object in-place here because some
+ // keys become unreadable with JS syntax preventing us from
+ // splitting the key into several lines...
+ var cfg = {}
+ cfg['Image name pattern | '+
+ '%f - full filename\n'+
+ '%n - filename\n'+
+ '%e - extension\n'+
+ '%gid - log gid\n'+
+ '%g - short gid\n'+
+ '%i - order'] = '%f'
+ cfg['Fav directory name'] = 'fav'
+ cfg['Destination'] = {ndir: dfl}
+
+ var keys = Object.keys(cfg)
+
+ formDialog(null, 'Export source: '+ state +'.', cfg, 'OK', 'exportPreviewsDialog')
.done(function(data){
exportTo(
- data['Destination'],
- data['Image name pattern'],
- data['Fav directory name'])
+ normalizePath(data[keys[2]]),
+ data[keys[0]],
+ data[keys[1]])
// XXX do real reporting...
showStatusQ('Copying data...')
@@ -758,7 +770,7 @@ function loadDirectoryDialog(dfl){
toggleSingleRibbonMode('off')
toggleMarkedOnlyView('off')
- path = path.trim()
+ path = normalizePath(path.trim())
statusNotify(loadDir(path))
})
.fail(function(){