Skip to content

Commit

Permalink
Extract FILENAMES["autopickup"] 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 a3226b5 commit a3f8f35
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/path_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ static std::string user_dir_value;
static std::string datadir_value;
static std::string base_path_value;
static std::string savedir_value;
static std::string autopickup_value;

/** Map where we store filenames */
std::map<std::string, std::string> FILENAMES;
Expand Down Expand Up @@ -117,7 +118,7 @@ void update_config_dir()
{
update_pathname( "options", config_dir_value + "options.json" );
update_pathname( "keymap", config_dir_value + "keymap.txt" );
update_pathname( "autopickup", config_dir_value + "auto_pickup.json" );
autopickup_value = config_dir_value + "auto_pickup.json";
}

void PATH_INFO::set_standard_filenames()
Expand Down Expand Up @@ -173,7 +174,7 @@ void PATH_INFO::set_standard_filenames()
#endif
update_pathname( "options", config_dir_value + "options.json" );
update_pathname( "keymap", config_dir_value + "keymap.txt" );
update_pathname( "autopickup", config_dir_value + "auto_pickup.json" );
autopickup_value = config_dir_value + "auto_pickup.json";
}

std::string find_translated_file( const std::string &path, const std::string &extension,
Expand Down Expand Up @@ -229,7 +230,7 @@ std::string find_translated_file( const std::string &path, const std::string &ex
}
std::string PATH_INFO::autopickup()
{
return FILENAMES["autopickup"];
return autopickup_value;
}
std::string PATH_INFO::base_colors()
{
Expand Down Expand Up @@ -487,7 +488,7 @@ void PATH_INFO::set_keymap( const std::string &keymap )

void PATH_INFO::set_autopickup( const std::string &autopickup )
{
update_pathname( "autopickup", autopickup );
autopickup_value = autopickup;
}

void PATH_INFO::set_motd( const std::string &motd )
Expand Down

0 comments on commit a3f8f35

Please sign in to comment.