Skip to content

when saving a file under an existing name fails, the file is deleted anyway #441

Closed
@gdementen

Description

@gdementen

This is extremely annoying. I had a large (valid) file, I introduced a few bad values in it, tried to save it. It failed (without error, see larray-project/larray-editor#75) and I then closed the editor to realize my file had disappeared, hence loosing my work!

This happens at least for saving to Excel, but might happen for other backends too.

This is going to be a tad annoying to fix:

if destpath exists:
    if overwrite:
        save file as temppath
        delete destpath
        rename temppath to destpath
    else:
       raise "{despath} already exists"
else:
    save file as destpath

Or, a tad simpler (but at tad less efficient):

save file as temppath
if destpath exists:
    if overwrite:
        delete destpath
    else:
        raise "{despath} already exists"
rename temppath to destpath

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions