mirror of
				https://github.com/wting/autojump
				synced 2025-06-13 12:54:07 +00:00 
			
		
		
		
	save the database in sorted form, for easier edition
This commit is contained in:
		
							parent
							
								
									0ee020c72c
								
							
						
					
					
						commit
						92b80073fd
					
				
							
								
								
									
										4
									
								
								autojump
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								autojump
									
									
									
									
									
								
							| @ -80,9 +80,9 @@ def save(path_dict, dic_file): | ||||
|     # Otherwise, fail quietly | ||||
|     if (not os.path.exists(dic_file)) or os.getuid() == os.stat(dic_file)[4]: | ||||
|         temp = NamedTemporaryFile(dir=CONFIG_DIR, delete=False) | ||||
|         for path in path_dict: | ||||
|         for path,weight in sorted(path_dict.items(),key=itemgetter(1),reverse=True): | ||||
|             # the db is stored in utf-8 | ||||
|             temp.write((unico("%s\t%s\n")%(path_dict[path],path)).encode("utf-8")) | ||||
|             temp.write((unico("%s\t%s\n")%(weight,path)).encode("utf-8")) | ||||
|         temp.flush() | ||||
|         os.fsync(temp) | ||||
|         temp.close() | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user