diff options
-rw-r--r-- | server/src/main.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/server/src/main.cpp b/server/src/main.cpp index 67e5fa6..08fe5b7 100644 --- a/server/src/main.cpp +++ b/server/src/main.cpp @@ -61,10 +61,15 @@ int main(int argc, char *argv[]) if(vm.count("config")) config_path = vm["config"].as<std::string>(); - if(boost::filesystem::exists(config_path) && boost::filesystem::is_regular(config_path)) - bpt::read_info(config_path, config); //TODO: finish this - else - std::cerr<<"failed to load config: \"" + config_path + "\", file does not exists or is not regular file\n"; + { + std::string tmp_path = config_path, home = getenv("HOME"); + for(std::string::size_type p1 = tmp_path.find("~"); p1 != std::string::npos; p1 = tmp_path.find("~", p1)) + tmp_path.replace(p1, 1, home); + if(boost::filesystem::exists(tmp_path) && boost::filesystem::is_regular(tmp_path)) + bpt::read_info(tmp_path, config); //TODO: finish this + else + std::cerr<<"failed to load config: \"" + config_path + "\", file does not exists or is not regular file\n"; + } if(vm.count("help")) |