Skip to content

Commit

Permalink
Option to use a per-server-ID updates directory.
Browse files Browse the repository at this point in the history
Change from fully specified path to one based on the ID from
servers.lst.  The option now just enables/disables the new path.
For example:  an ID of pk uses <config base>/updates/pk/.
  • Loading branch information
pjbroad committed Oct 20, 2024
1 parent 398fdba commit 9fa4c57
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion elconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -3157,7 +3157,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);
add_var(OPT_BOOL,"use_perserver_updates_dir", "uaupdir", &use_perserver_updates_dir, change_var, 0,"Use Per-Server Updates Directory","If enabled a per-server-ID updates directory is used rather than the default that uses the client version. A change only takes effect after a client restart.",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: 1 addition & 1 deletion init.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ char datadir[256]=DATA_DIR;
char datadir[256]="./";
#endif //DATA_DIR

char alt_updates_dir[256]="";
int use_perserver_updates_dir = 0;

static const char *cfg_filename = "el.cfg";
#ifdef JSON_FILES
Expand Down
2 changes: 1 addition & 1 deletion init.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +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> */
extern int use_perserver_updates_dir; /*!< by default <config base>/updates/<version> is used for updates, if true <config base>/updates/server_ID will be used */

/*!
* \ingroup loadsave
Expand Down
4 changes: 2 additions & 2 deletions io/elpathwrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ const char * get_path_updates(void)
}

#ifndef MAP_EDITOR
if (alt_updates_dir[0] != '\0')
safe_snprintf(locbuffer, sizeof(locbuffer), "%s", alt_updates_dir);
if (use_perserver_updates_dir)
safe_snprintf(locbuffer, sizeof(locbuffer), "%supdates/%s/", get_path_config_base(), get_server_name());
else
#endif
safe_snprintf(locbuffer, sizeof(locbuffer), "%supdates/%d_%d_%d/", get_path_config_base(), VER_MAJOR, VER_MINOR, VER_RELEASE);
Expand Down

0 comments on commit 9fa4c57

Please sign in to comment.