Allow directory bookmarks to be relative to Data_directory

see http://pulkomandy.tk/projects/GrafX2/ticket/45
Still to do : the "Set Rel" which is the difficult part :)

Also it may be better to use Program_directory instead of Data_directory
This commit is contained in:
Thomas Bernard 2018-01-18 22:10:09 +01:00
parent 52ccd396d5
commit 175ea62b02
No known key found for this signature in database
GPG Key ID: 0FF11B67A5C0863C

View File

@ -2330,6 +2330,17 @@ byte Button_Load_or_Save(T_Selector_settings *settings, byte load, T_IO_Context
directory_to_change_to = Selector_filename; directory_to_change_to = Selector_filename;
// We must enter the directory // We must enter the directory
if (directory_to_change_to[0] == '.' &&
(directory_to_change_to[1] == '/' || directory_to_change_to[1] == '\\' ||
(directory_to_change_to[1] == '.' &&
(directory_to_change_to[2] == '/' || directory_to_change_to[2] == '\\')))) // Relative path
{
GFX2_Log(GFX2_DEBUG, "Relative bookmark %s. Change to %s first\n",
directory_to_change_to, Data_directory);
Change_directory(Data_directory);
}
if (Change_directory(directory_to_change_to) == 0) if (Change_directory(directory_to_change_to) == 0)
{ {
short pos; short pos;