mirror of
				https://github.com/flynx/pWiki.git
				synced 2025-10-30 18:40:08 +00:00 
			
		
		
		
	cleanup almist done...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									db57070cfb
								
							
						
					
					
						commit
						b984928e68
					
				
							
								
								
									
										20
									
								
								pwiki2.js
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								pwiki2.js
									
									
									
									
									
								
							| @ -930,13 +930,27 @@ async function(base, sub, options={index: '.index'}){ | ||||
| var cleanup = | ||||
| module.cleanup = | ||||
| async function(base, options={index: '.index'}){ | ||||
| 	var {index} = options | ||||
| 
 | ||||
| 	glob(module.path.join(base, '**/*')) | ||||
| 		.on('end', function(paths){ | ||||
| 		.on('end', async function(paths){ | ||||
| 			paths | ||||
| 				.sort(function(a, b){ | ||||
| 					return b.length - a.length }) | ||||
| 			// XXX
 | ||||
| 		}) } | ||||
| 			for(var path of paths){ | ||||
| 				var stat = await fs.promises.stat(base) | ||||
| 				if(stat.isDirectory()){ | ||||
| 					var children = await fs.promises.readdir(path) | ||||
| 					// empty -> remove...
 | ||||
| 					if((children.length == 0){ | ||||
| 						fs.promises.rmdir(path)  | ||||
| 						continue } | ||||
| 					// dir -> file...
 | ||||
| 					if(children.length == 1  | ||||
| 							&& children[0] == index){ | ||||
| 						// XXX
 | ||||
| 						continue } | ||||
| 				} } }) } | ||||
| 
 | ||||
| 
 | ||||
| // XXX add a lock file and prevent multiple adapters from controlling 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user