From 175ea62b02b277e08c07a46f0eb5ed2b1b4fc7c1 Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Thu, 18 Jan 2018 22:10:09 +0100 Subject: [PATCH] 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 --- src/filesel.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/filesel.c b/src/filesel.c index 766d9d1d..43715d95 100644 --- a/src/filesel.c +++ b/src/filesel.c @@ -2330,6 +2330,17 @@ byte Button_Load_or_Save(T_Selector_settings *settings, byte load, T_IO_Context directory_to_change_to = Selector_filename; // 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) { short pos;