Skip to content

Commit

Permalink
fix chmod
Browse files Browse the repository at this point in the history
  • Loading branch information
clemos committed Nov 30, 2014
1 parent 31a0c0c commit 58cad47
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions HaxeComplete.py
Original file line number Diff line number Diff line change
Expand Up @@ -1782,16 +1782,16 @@ def save_temp_file( self , view ) :
if not os.path.exists( tdir ):
os.mkdir( tdir )

if os.path.exists( fn ):
if os.path.exists( fn ):
if os.path.exists( temp ):
os.chmod( temp , os.stat( temp ).st_mode | stat.S_IWRITE )
shutil.copy2( temp , fn )
os.chmod( temp, stat.S_IWRITE )
os.remove( temp )
# copy saved file to temp for future restoring
shutil.copy2( fn , temp )

# write current source to file
os.chmod( fn, stat.S_IWRITE )
os.chmod( fn , os.stat( fn ).st_mode | stat.S_IWRITE )
# write current source to file
f = codecs.open( fn , "wb" , "utf-8" , "ignore" )
f.write( src )
f.close()
Expand All @@ -1802,8 +1802,10 @@ def clear_temp_file( self , view , temp ) :
fn = view.file_name()

if os.path.exists( temp ) :
os.chmod( temp , os.stat( temp ).st_mode | stat.S_IWRITE )

shutil.copy2( temp , fn )
os.chmod( temp, stat.S_IWRITE )
# os.chmod( temp, stat.S_IWRITE )
os.remove( temp )
else:
# fn didn't exist in the first place, so we remove it
Expand Down

0 comments on commit 58cad47

Please sign in to comment.