Enable "Set Rel" for directory bookmarks only with portable installation

add a global variable to store if we are in a portable installation
This commit is contained in:
Thomas Bernard 2019-02-04 23:58:26 +01:00
parent 02f9d68f8e
commit e7bb7c8684
No known key found for this signature in database
GPG Key ID: 0FF11B67A5C0863C
3 changed files with 14 additions and 2 deletions

View File

@ -1221,7 +1221,8 @@ static void Display_bookmark(T_Dropdown_button * Button, int bookmark_number)
Window_dropdown_clear_items(Button);
Window_dropdown_add_item(Button,0,"Set");
#if !(defined(__amigaos4__) || defined(__AROS__) || defined(__MORPHOS__) || defined(__amigaos__))
Window_dropdown_add_item(Button,3,"Set Rel");
if (Portable_Installation_Detected)
Window_dropdown_add_item(Button,3,"Set Rel");
#endif
if (Config.Bookmark_directory[bookmark_number])
{

View File

@ -770,6 +770,9 @@ GFX2_GLOBAL signed char File_error;
/// Current line number when reading/writing gfx2.ini
GFX2_GLOBAL int Line_number_in_INI_file;
/// Set to true when the .cfg and .ini files are along the executable
GFX2_GLOBAL byte Portable_Installation_Detected;
// -- For iconv
#ifdef ENABLE_FILENAMES_ICONV

View File

@ -52,6 +52,7 @@
#include "struct.h"
#include "io.h"
#include "setup.h"
#include "global.h"
#if defined(__GP2X__) || defined(__WIZ__) || defined(__CAANOO__)
// This is a random default value ...
@ -192,7 +193,12 @@ void Set_config_directory(const char * program_dir, char * config_dir)
strcpy(filename, config_dir);
strcat(filename, CONFIG_FILENAME);
if (!File_exists(filename))
if (File_exists(filename))
{
// gfx2.cfg found, this is a portable installation
Portable_Installation_Detected = 1;
}
else
{
char *config_parent_dir;
#if defined(__WIN32__) || defined(WIN32)
@ -227,6 +233,7 @@ void Set_config_directory(const char * program_dir, char * config_dir)
config_parent_dir = getenv("HOME");
}
#endif
Portable_Installation_Detected = 0;
if (config_parent_dir && config_parent_dir[0]!='\0')
{
@ -254,6 +261,7 @@ void Set_config_directory(const char * program_dir, char * config_dir)
{
// Echec: on se rabat sur le repertoire de l'executable.
strcpy(config_dir,program_dir);
Portable_Installation_Detected = 1;
#if defined(__macosx__)
strcat(config_dir, "../");
#endif