Page 1 of 1

Editor's current way to backup

PostPosted: 27 Sep 2014, 12:17
by Bertram
Heya guys. :D

I realized something while digging through code:
Here: https://github.com/OpenDungeons/OpenDun ... r.cpp#L833

When saving a map in the editor, it seems it is making a backup each time. I don't know whether it is the right thing to do. I'll explain:
- When you open a level, you don't want to overwrite the previous version accidentally, and the backup is here for that. -> Ok.
- The first time you save, the former version is backed-up and the new one is written instead. -> Still ok.

- But when you save the second time, the modified version saved the first time erases the actual former version, and the newest version is written instead.
Here I don't know if it's what is desired. If I'm running the editor, I won't want to lose the previous version (aka the one before I started the editor). Hence I wonder whether we should backup only at the first save.

What do you think, guys? Danimal, what would you expect?

Best regards,

Re: Editor's current way to backup

PostPosted: 27 Sep 2014, 13:20
by Danimal
Yes, at the first one only is a good idea, minor modifications are not that much of a problem to undo, having the original map to return to is better than having the WIP one.

Re: Editor's current way to backup

PostPosted: 27 Sep 2014, 15:02
by Bertram
Ok, I'll open an issue. :)

Re: Editor's current way to backup

PostPosted: 27 Sep 2014, 18:00
by hwoarangmy
In the former editor code, when you saved a map, it used to be named as "original_map_name".out
After a map was saved, it was not launchable because of that.
As you can imagine, when I've fixed the editor, I've been thinking about that a bit :
If we consider backuping the original map only (as you suggest), I can see 2 ways to edit a map :
- Edit an existing map : The map is already in the repo, no point in doing a backup.
- Creating an existing map by copying another one (or, when possible, creating a new map from scratch) : Usually, the moder will save pretty soon after beginning working on the map. From there, no backup will be done. In this case, we will almost always backup an empty map.

Then, last point, all the editors I know (mostly text editors - like winmerge, blender, ...) that create backups change the backup each time the file is saved.

As you probably uderstood, IMHO, there is no point in saving the map original state. If you think backuping like it is currently done is useless, we could not backup at all. The other way would be to create more than one backup (like blender does, renaming all backups each time a file is saved).

Re: Editor's current way to backup

PostPosted: 27 Sep 2014, 21:08
by Bertram
Hey, :)

@hwoarangmy:
Sorry to point out something that feels a useless problem to you. I must say it is also true (and don't want to enter an overly complicated solution, anyway.)

If everybody agrees to hwoarangmy's notice, the I'll close the issue. What do you think Danimal, finally?

Best regards,

Re: Editor's current way to backup

PostPosted: 27 Sep 2014, 22:00
by hwoarangmy
Bertram {l Wrote}:Sorry to point out something that feels a useless problem to you
I'm just giving my point of view as I've already thought about it :) But my word is not a rule ;)

Bertram {l Wrote}:and don't want to enter an overly complicated solution, anyway
Looking for a non existing backup name like blender does is not that complicated ;)

Re: Editor's current way to backup

PostPosted: 27 Sep 2014, 22:43
by Bertram
You know what? The more I think about it, the more I think I shouldn't have bothered us with this.
Let's release the editor as is. Danimal will tell us what's the next thing he needs or the next bug we'll encounter. :)

I'll close the issue.