mirror of
https://github.com/wting/autojump
synced 2024-10-27 20:34:07 +00:00
add backup file
This commit is contained in:
parent
3c5f181a4b
commit
99d82be473
4
autojump
4
autojump
@ -58,6 +58,10 @@ def save(path_dict,dic_file):
|
|||||||
os.rename(dic_file+".tmp",dic_file) #cf. http://thunk.org/tytso/blog/2009/03/15/dont-fear-the-fsync/
|
os.rename(dic_file+".tmp",dic_file) #cf. http://thunk.org/tytso/blog/2009/03/15/dont-fear-the-fsync/
|
||||||
except OSError:
|
except OSError:
|
||||||
pass #Fail quietly, this usually means a concurrent autojump process already did the job
|
pass #Fail quietly, this usually means a concurrent autojump process already did the job
|
||||||
|
import time #backup file
|
||||||
|
if not os.path.exists(dic_file+".bak") or time.time()-os.path.getmtime(dic_file+".bak")>86400:
|
||||||
|
import shutil
|
||||||
|
shutil.copy(dic_file,dic_file+".bak")
|
||||||
|
|
||||||
def forget(path_dict,dic_file):
|
def forget(path_dict,dic_file):
|
||||||
"""Gradually forget about directories. Only call from the actual jump since it can take time"""
|
"""Gradually forget about directories. Only call from the actual jump since it can take time"""
|
||||||
|
Loading…
Reference in New Issue
Block a user