parent
d5ac811eda
commit
4ecd1314fd
|
@ -659,6 +659,8 @@ class FileBuffer(Buffer):
|
|||
if self.changed_on_disk():
|
||||
raise Exception, "oh no! %r has changed on-disk!" % self.path
|
||||
|
||||
exists = os.path.exists(self.path)
|
||||
if exists:
|
||||
temp_path = self._temp_path()
|
||||
shutil.copyfile(self.path, temp_path)
|
||||
|
||||
|
@ -672,12 +674,12 @@ class FileBuffer(Buffer):
|
|||
f2.write(self.bytemark + data)
|
||||
f2.close()
|
||||
except:
|
||||
shutil.copyfile(temp_path, self.path)
|
||||
if exists: shutil.copyfile(temp_path, self.path)
|
||||
else:
|
||||
self.store_checksum(data)
|
||||
self.modified = False
|
||||
finally:
|
||||
os.unlink(temp_path)
|
||||
if exists: os.unlink(temp_path)
|
||||
def save_as(self, path):
|
||||
self.path = path
|
||||
self.save()
|
||||
|
|
Loading…
Reference in New Issue