Skip to content

Commit

Permalink
Create temporary file on the same device as data.
Browse files Browse the repository at this point in the history
One idea for why the database is occasionally purged is due to the
temporary file being on a separate device than the database. This
patch implements @lilydjwg's suggestion here:

    wting#391 (comment)
  • Loading branch information
wting committed Sep 7, 2018
1 parent 8eace44 commit bc4ea61
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion bin/autojump
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ from autojump_utils import sanitize
from autojump_utils import take
from autojump_utils import unico

VERSION = '22.5.1'
VERSION = '22.5.2'
FUZZY_MATCH_THRESHOLD = 0.6
TAB_ENTRIES_COUNT = 9
TAB_SEPARATOR = '__'
Expand Down
5 changes: 3 additions & 2 deletions bin/autojump_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,12 @@ def migrate_osx_xdg_data(config):

def save(config, data):
"""Save data and create backup, creating a new data file if necessary."""
create_dir(os.path.dirname(config['data_path']))
data_dir = os.path.dirname(config['data_path'])
create_dir(data_dir)

# atomically save by writing to temporary file and moving to destination
try:
temp = NamedTemporaryFile(delete=False)
temp = NamedTemporaryFile(delete=False, dir=data_dir)
# Windows cannot reuse the same open file name
temp.close()

Expand Down
2 changes: 1 addition & 1 deletion docs/autojump.1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.\" Automatically generated by Pandoc 1.16.0.2
.\"
.TH "autojump" "1" "2018\-09\-06" "release\-v22.5.1" ""
.TH "autojump" "1" "2018\-09\-07" "release\-v22.5.2" ""
.hy
.SS NAME
.PP
Expand Down
4 changes: 2 additions & 2 deletions docs/manpage_header.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
% autojump(1) release-v22.5.1
% autojump(1) release-v22.5.2
%
% 2018-09-06
% 2018-09-07

0 comments on commit bc4ea61

Please sign in to comment.