Browse Source

move config to new location if it exists

xdg
Jørgen Lien Sellæg 5 years ago
parent
commit
e0b73151a9
  1. 13
      src/config.cpp

13
src/config.cpp

@ -27,6 +27,19 @@ Config::Config() {
void Config::load() {
try {
const auto old_config_file_path = filesystem::get_home_path() / ".juci" / "config" / "config.json";
if(juci_config_file != old_config_file_path && boost::filesystem::exists(old_config_file_path)) {
boost::filesystem::rename(old_config_file_path, old_config_file_path.parent_path().parent_path() / "config.json");
const auto old_config_directory_path = old_config_file_path.parent_path();
if(boost::filesystem::is_empty(old_config_directory_path)) {
boost::filesystem::remove_all(old_config_directory_path);
}
std::string command("mv " + old_config_directory_path.parent_path().string() + " " + juci_config_file.parent_path().string());
if(TinyProcessLib::Process(command).get_exit_status() == 0) {
boost::filesystem::remove_all(old_config_directory_path);
}
}
boost::filesystem::create_directories(home_juci_path);
if(!boost::filesystem::exists(juci_config_file))

Loading…
Cancel
Save