diff options
author | Yaniv Kamay <ykamay@redhat.com> | 2010-01-11 19:39:54 +0200 |
---|---|---|
committer | Yaniv Kamay <ykamay@redhat.com> | 2010-01-11 19:39:54 +0200 |
commit | 3c1ff6448d847e6e96425fa166446b99bac5e592 (patch) | |
tree | 10049d55dc16f597058e2127e0270f85d9430d33 | |
parent | ad121810278c1e2851f74c370e1cb36e52367be3 (diff) | |
download | spice-3c1ff6448d847e6e96425fa166446b99bac5e592.tar.gz spice-3c1ff6448d847e6e96425fa166446b99bac5e592.tar.xz spice-3c1ff6448d847e6e96425fa166446b99bac5e592.zip |
client: fix logger init mix-up
-rw-r--r-- | client/application.cpp | 6 | ||||
-rw-r--r-- | client/x11/platform.cpp | 8 |
2 files changed, 10 insertions, 4 deletions
diff --git a/client/application.cpp b/client/application.cpp index a0e34360..839885d8 100644 --- a/client/application.cpp +++ b/client/application.cpp @@ -1971,12 +1971,12 @@ void Application::init_logger() #ifdef RED_DEBUG root.setPriority(log4cpp::Priority::DEBUG); root.removeAllAppenders(); - ::close(fd); - root.addAppender(new log4cpp::RollingFileAppender("_", log_file_name)); + root.addAppender(new log4cpp::FileAppender("_", fd)); #else root.setPriority(log4cpp::Priority::INFO); root.removeAllAppenders(); - root.addAppender(new log4cpp::FileAppender("_", fd)); + ::close(fd); + root.addAppender(new log4cpp::RollingFileAppender("_", log_file_name)); #endif } diff --git a/client/x11/platform.cpp b/client/x11/platform.cpp index df689c03..02250f11 100644 --- a/client/x11/platform.cpp +++ b/client/x11/platform.cpp @@ -1915,11 +1915,17 @@ void Platform::get_app_data_dir(std::string& path, const std::string& app_name) { const char* home_dir = getenv("HOME"); - if (!home_dir) { + if (!home_dir || strlen(home_dir) == 0) { throw Exception("get home dir failed"); } path = home_dir; + std::string::iterator end = path.end(); + + while (end != path.begin() && *(end - 1) == '/') { + path.erase(--end); + } + path += "/."; path += app_name; |