several fixes...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2013-07-01 18:05:50 +04:00
parent 24d90345f3
commit bb413be06b
3 changed files with 36 additions and 11 deletions

View File

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

View File

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

View File

@ -718,16 +718,28 @@ function exportPreviewsDialog(state, dfl){
updateStatus('Export...').show()
formDialog(null, '<b>Export source:</b> '+ 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, '<b>Export source:</b> '+ 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(){