Lua: now remembers which directory you last browsed when you quit. Fixed an issue where gfx2.ini isn't saved if there's a file gfx2.$$$ in same directory (Like after a crash)

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1763 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Yves Rizoud
2011-04-03 14:43:16 +00:00
parent e10fe19ae6
commit f34417919f
6 changed files with 61 additions and 51 deletions

View File

@@ -34,6 +34,8 @@
#include "misc.h"
#include "readini.h"
#include "setup.h"
#include "realpath.h"
#include "io.h"
void Load_INI_clear_string(char * str, byte keep_comments)
{
@@ -933,7 +935,18 @@ int Load_INI(T_Config * conf)
}
}
// Optional, Location of last directory used for Lua scripts browsing (>=2.3)
conf->Scripts_directory[0]='\0';
if (!Load_INI_get_string (file,buffer,"Scripts_directory",value_label, 1))
{
strcpy(conf->Scripts_directory,value_label);
}
if (conf->Scripts_directory[0]=='\0')
{
// Default when empty:
Realpath(Data_directory, conf->Scripts_directory);
Append_path(conf->Scripts_directory, "scripts", NULL);
}
// Insert new values here