Skip to content

Commit

Permalink
Extract FILENAMES["base_path"] into a static variable
Browse files Browse the repository at this point in the history
  • Loading branch information
BevapDin committed Nov 17, 2019
1 parent d3f6f43 commit 6487979
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/path_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ static std::string gfxdir_value;
static std::string config_dir_value;
static std::string user_dir_value;
static std::string datadir_value;
static std::string base_path_value;

/** Map where we store filenames */
std::map<std::string, std::string> FILENAMES;
Expand All @@ -46,7 +47,7 @@ void PATH_INFO::init_base_path( std::string path )
}
}

FILENAMES["base_path"] = path;
base_path_value = path;
}

void PATH_INFO::init_user_dir( const char *ud )
Expand Down Expand Up @@ -121,13 +122,13 @@ void update_config_dir()
void PATH_INFO::set_standard_filenames()
{
// Special: data_dir and gfx_dir
if( !FILENAMES["base_path"].empty() ) {
if( !base_path_value.empty() ) {
#if defined(DATA_DIR_PREFIX)
datadir_value = FILENAMES["base_path"] + "share/cataclysm-dda/";
datadir_value = base_path_value + "share/cataclysm-dda/";
gfxdir_value = datadir_value + "gfx/";
#else
datadir_value = FILENAMES["base_path"] + "data/";
gfxdir_value = FILENAMES["base_path"] + "gfx/";
datadir_value = base_path_value + "data/";
gfxdir_value = base_path_value + "gfx/";
#endif
} else {
datadir_value = "data/";
Expand Down Expand Up @@ -235,7 +236,7 @@ std::string PATH_INFO::base_colors()
}
std::string PATH_INFO::base_path()
{
return FILENAMES["base_path"];
return base_path_value;
}
std::string PATH_INFO::colors()
{
Expand Down

0 comments on commit 6487979

Please sign in to comment.