Skip to content

Commit

Permalink
Added a config option for an alternative updates path for data files.
Browse files Browse the repository at this point in the history
This is the full path to the directory, a trailing "/" will be
added if needed.  The path does not have to be within the el config
tree so long as you have read access.  The path is configurable from
the server tab of options.
  • Loading branch information
pjbroad committed Oct 17, 2024
1 parent fa997f6 commit 4724318
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions elconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -3156,6 +3156,7 @@ static void init_ELC_vars(void)
SERVER);
add_var(OPT_BOOL,"write_ini_on_exit", "wini", &write_ini_on_exit, change_var, 1,"Save INI","Save options when you quit",SERVER);
add_var(OPT_STRING,"data_dir","dir",datadir,change_dir_name,90,"Data Directory","Place were we keep our data. Can only be changed with a Client restart.",SERVER);
add_var(OPT_STRING,"alt_updates_dir","aupdir",alt_updates_dir,change_dir_name,90,"Alt Updates Directory","Full path to an alternative updates directory for data files. Normally blank.",SERVER);
#endif // ANDROID
add_var(OPT_BOOL,"serverpopup","spu",&use_server_pop_win,change_var,1,"Use Special Text Window","Toggles whether server messages from channel 255 are displayed in a pop up window.",SERVER);
/* Note: We don't take any action on the already-running thread, as that wouldn't necessarily be good. */
Expand Down
2 changes: 2 additions & 0 deletions init.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ char datadir[256]=DATA_DIR;
char datadir[256]="./";
#endif //DATA_DIR

char alt_updates_dir[256]="";

static const char *cfg_filename = "el.cfg";
#ifdef JSON_FILES
static const char *client_state_filename = "client_state.json";
Expand Down
1 change: 1 addition & 0 deletions init.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ typedef struct

extern char configdir[256]; /*!< the default directory where we look for configuration files */
extern char datadir[256]; /*!< the default directory where we look for data files (aka installation dir) */
extern char alt_updates_dir[256]; /*!< an alternative updates directory for data files, if blank, default is <config base>/updates/<version> */

/*!
* \ingroup loadsave
Expand Down
5 changes: 4 additions & 1 deletion io/elpathwrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,10 @@ const char * get_path_updates(void)
return locbuffer;
}

safe_snprintf(locbuffer, sizeof(locbuffer), "%supdates/%d_%d_%d/", get_path_config_base(), VER_MAJOR, VER_MINOR, VER_RELEASE);
if (alt_updates_dir[0] != '\0')
safe_snprintf(locbuffer, sizeof(locbuffer), "%s", alt_updates_dir);
else
safe_snprintf(locbuffer, sizeof(locbuffer), "%supdates/%d_%d_%d/", get_path_config_base(), VER_MAJOR, VER_MINOR, VER_RELEASE);

return locbuffer;
}
Expand Down

0 comments on commit 4724318

Please sign in to comment.