|
8 | 8 | ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ## |
9 | 9 | ''' Common interface for any image format--volume or surface, binary or xml.''' |
10 | 10 |
|
| 11 | +importos |
11 | 12 | importwarnings |
12 | 13 |
|
13 | 14 | from .externals.siximportstring_types |
@@ -347,7 +348,15 @@ def to_filename(self, filename): |
347 | 348 | ------- |
348 | 349 | None |
349 | 350 | ''' |
350 | | -self.file_map=self.filespec_to_file_map(filename) |
| 351 | +self.file_map=file_map=self.filespec_to_file_map(filename) |
| 352 | +for_,fhinfile_map.items(): |
| 353 | +ifnotisinstance(fh,FileHolder): |
| 354 | +continue |
| 355 | +ifos.path.exists(fh.filename): |
| 356 | +# Remove previous file where new file would be saved |
| 357 | +# Necessary e.g. for cases where file is a symlink pointing |
| 358 | +# to some non-writable file (e.g. under git annex control) |
| 359 | +os.unlink(fh.filename) |
351 | 360 | self.to_file_map() |
352 | 361 |
|
353 | 362 | defto_filespec(self,filename): |
|