Page 1 of 1

[Mod]Simple map backup [0.1][backup]

PostPosted: Mon Jul 15, 2013 18:31
by webdesigner97
Hello,
some players have the problem that their maps don't save anymore. That's because one or more files in the world directory are damaged and need to be replaced with a copy from a backup. The problem is, that many players don't have backups of their worlds, so if their maps won't get saved anymore, they'll put a random file there with a different seed which makes the world look ugly. The mod is very simple and does NOT copy any player information and map.sqlite. Also I does NOT automatically recover corrupted files! If you find out that your map doesn't save anymore, you just have to copy the files in minetest/mapbackup/worldname to minetest/worlds/worldname (override old ones)
This mod copies the following files of your worlddirectory to minetest/mapbackup/worldname:

* auth.txt
* env_meta.txt
* ipban.txt
* map_meat.txt
* rollback.txt
* world.mt

The files are copied only once: When you first enter your world. To manually backup them, just run /backup.

Depends: none
License: WTFPL
Download: Dropbox

Singleplayer only

PostPosted: Tue Jul 16, 2013 09:34
by webdesigner97
Fixed a bug which didn't copy map_meta.txt.

PostPosted: Tue Jul 16, 2013 10:48
by PilzAdam
Are you sure its safe to access the files while minetest is running?

PostPosted: Tue Jul 16, 2013 11:24
by webdesigner97
When else should I access them if this is a mod? And I just open them in read-mode, so I think nothing bad will happen :D

PostPosted: Tue Jul 16, 2013 16:30
by LionsDen
I have a batch file that copies my world and even creates a secondary backup. It deletes the secondary backup then renames the current backup to be secondary and then copies the world files for the current backup.

EDIT: For clarity.

PostPosted: Tue Jul 16, 2013 16:46
by webdesigner97
LionsDen wrote:I have a batch file that copies my world and even creates a secondary backup. It deletes the secondary backup then renames the current backup to be secondary and then copies the world files for the current backup.

EDIT: For clarity.

Also nice. But not everybody can create batchfiles, so this mod could be an altennative. I'll make it better someday, so it will automatically detect if your env_meta.txt is broken :)

PostPosted: Tue Jul 16, 2013 17:09
by Jordach
Worlds / Server's won't start if env_meta.txt is broken. So that code would be pointless. Although a man may dream...

PostPosted: Tue Jul 16, 2013 17:55
by webdesigner97
Jordach wrote:Worlds / Server's won't start if env_meta.txt is broken. So that code would be pointless. Although a man may dream...

But id the file breaky while the server is running? That happened 2 times on my singleplayer world :O

PostPosted: Wed Jul 17, 2013 15:48
by LionsDen
webdesigner97 wrote:Also nice. But not everybody can create batchfiles, so this mod could be an altennative. I'll make it better someday, so it will automatically detect if your env_meta.txt is broken :)


In the meantime, people can do what I do. I just modified my batch copy file so it can work with only 1 input required. To use it:

1. Create a directory named Backup in your worlds directory.

2. Copy the text in the code box below.

3. Open a text editor and paste the text into it.

4. Save the file to the Backup directory created in step 1 as "something.bat" without the quotes.
The something can be anything, I use bakup.bat as the name for it.

5. Whenever you want to backup a world, just go to that directory and run the batch file. It will prompt you
for the world's name. Just enter it and if the world exists exactly as you typed it. it will copy it.

I know this works in Windows XP, I don't have any other windows version to test it on.

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
SET /P DNAME=World to Backup:
IF EXIST "%DNAME% Prev" RD /S /Q "%DNAME% Prev"
IF EXIST "%DNAME%" RENAME "%DNAME%" "%DNAME% Prev"
MD %DNAME%
IF EXIST "..\%DNAME%" XCOPY "..\%DNAME%\*.*" "%DNAME%\*.*" /E


Hope this helps out some people.