mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-10-31 19:30:07 +00:00 
			
		
		
		
	more work on exportTo(..), now using node.js fs.extra...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									01e8e39fc9
								
							
						
					
					
						commit
						a8ce503b92
					
				| @ -26,6 +26,7 @@ if(window.CEF_dumpJSON != null){ | ||||
| 	console.log('node-webkit mode: loading...') | ||||
| 
 | ||||
| 	var fs = require('fs') | ||||
| 	var fse = require('fs.extra') | ||||
| 	var proc = require('child_process') | ||||
| 	var gui = require('nw.gui') | ||||
| 
 | ||||
| @ -60,12 +61,12 @@ if(window.CEF_dumpJSON != null){ | ||||
| 		// XXX make dirs...
 | ||||
| 		if(!fs.existsSync(path)){ | ||||
| 			console.log('making:', path) | ||||
| 			// XXX NOTE: this will not make more than one dir...
 | ||||
| 			fs.mkdirSync(path) | ||||
| 			fse.mkdirRecursiveSync(path) | ||||
| 		} | ||||
| 
 | ||||
| 		if(!fs.existsSync(dst)){ | ||||
| 			fs.linkSync(src, dst) | ||||
| 			// NOTE: this is not sync...
 | ||||
| 			return fse.copy(src, dst) | ||||
| 		} | ||||
| 	} | ||||
| 	window.dumpJSON = function(path, data){ | ||||
| @ -78,9 +79,8 @@ if(window.CEF_dumpJSON != null){ | ||||
| 		dirs = dirs.join('/') | ||||
| 		// build path...
 | ||||
| 		if(!fs.existsSync(dirs)){ | ||||
| 			console.log('making:', dirs, path) | ||||
| 			// XXX NOTE: this will not make more than one dir...
 | ||||
| 			fs.mkdirSync(dirs) | ||||
| 			console.log('making:', path) | ||||
| 			fse.mkdirRecursiveSync(path) | ||||
| 		} | ||||
| 		return fs.writeFileSync(path, JSON.stringify(data), encoding='utf8') | ||||
| 	} | ||||
|  | ||||
| @ -557,11 +557,11 @@ function updateRibbonsFromFavDirs(){ | ||||
| 
 | ||||
| // Export current state to directory...
 | ||||
| //
 | ||||
| // NOTE: if size is null, the original image will be copied...
 | ||||
| function exportTo(path, im_name, dir_name, size){ | ||||
| 	path = path == null ? BASE_URL : path | ||||
| 	im_name = im_name == null ? '%f' : im_name | ||||
| 	dir_name = dir_name == null ? 'fav' : dir_name | ||||
| 	size = size == null ? 1000 : size | ||||
| 
 | ||||
| 	var base_path = path | ||||
| 	path = normalizePath(path) | ||||
| @ -598,8 +598,7 @@ function exportTo(path, im_name, dir_name, size){ | ||||
| 
 | ||||
| 			dest = path +'/'+ dest | ||||
| 
 | ||||
| 			// XXX link...
 | ||||
| 			//console.log('>>>', dest)
 | ||||
| 			// copy... 
 | ||||
| 			copyFile(src, dest) | ||||
| 		} | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user