Skip to content

Commit

Permalink
Merge pull request #46 from nullnull/master
Browse files Browse the repository at this point in the history
prevent unexpected permission changing
  • Loading branch information
seanliang committed Nov 24, 2014
2 parents a8d8322 + e9e5a59 commit 4ddabbe
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ConvertToUTF8.py
Expand Up @@ -467,6 +467,7 @@ def run(self, edit):
fp.close()
if not get_setting(view, 'lazy_reload'):
# os.rename has "Invalid cross-device link" issue
os.chmod(tmp_name, os.stat(file_name)[0])
shutil.move(tmp_name, file_name)
else:
# copy the timestamp from original file
Expand Down Expand Up @@ -625,6 +626,7 @@ def on_deactivated(self, view):
file_name = view.file_name()
if get_setting(view, 'lazy_reload'):
tmp_name = os.path.join(TMP_DIR, get_temp_name(file_name))
os.chmod(tmp_name, os.stat(file_name)[0])
shutil.move(tmp_name, file_name)
remove_reverting(file_name)
view.settings().set('revert_to_scratch', not view.is_dirty())
Expand Down

0 comments on commit 4ddabbe

Please sign in to comment.