mirror of
https://github.com/wting/autojump
synced 2024-10-27 20:34:07 +00:00
parent
36daeb1e32
commit
1bc3440968
3
autojump
3
autojump
@ -49,6 +49,9 @@ def dicadd(dic, key, increment=1):
|
|||||||
def save(path_dict, dic_file):
|
def save(path_dict, dic_file):
|
||||||
"""Save the database in an atomic way, and preserve
|
"""Save the database in an atomic way, and preserve
|
||||||
a backup file."""
|
a backup file."""
|
||||||
|
# If the dic_file exists, check that it belongs to us
|
||||||
|
# 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)
|
temp = NamedTemporaryFile(dir=CONFIG_DIR, delete=False)
|
||||||
pickle.dump(path_dict, temp, -1)
|
pickle.dump(path_dict, temp, -1)
|
||||||
temp.flush()
|
temp.flush()
|
||||||
|
Loading…
Reference in New Issue
Block a user