diff options
author | Yaniv Kamay <ykamay@redhat.com> | 2010-01-11 19:30:39 +0200 |
---|---|---|
committer | Yaniv Kamay <ykamay@redhat.com> | 2010-01-11 19:30:39 +0200 |
commit | ad121810278c1e2851f74c370e1cb36e52367be3 (patch) | |
tree | e6cf3525bcf2b1161bbe5177d9c60f90183736a4 /client/x11/platform.cpp | |
parent | 3eae1c80d97ce6d1e0eee69f7454973abdb94ef6 (diff) | |
download | spice-ad121810278c1e2851f74c370e1cb36e52367be3.tar.gz spice-ad121810278c1e2851f74c370e1cb36e52367be3.tar.xz spice-ad121810278c1e2851f74c370e1cb36e52367be3.zip |
client: move log file to spicec appdata dir
Diffstat (limited to 'client/x11/platform.cpp')
-rw-r--r-- | client/x11/platform.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/client/x11/platform.cpp b/client/x11/platform.cpp index 4a1f9b23..df689c03 100644 --- a/client/x11/platform.cpp +++ b/client/x11/platform.cpp @@ -64,8 +64,6 @@ #define USE_XRANDR_1_2 #endif -#define SPICE_CONFIG_DIR ".spicec/" - static Display* x_display = NULL; static bool x_shm_avail = false; static XVisualInfo **vinfo = NULL; @@ -1913,16 +1911,27 @@ bool Platform::is_monitors_pos_valid() return (ScreenCount(x_display) == 1); } -void Platform::get_spice_config_dir(std::string& path) +void Platform::get_app_data_dir(std::string& path, const std::string& app_name) { - char* home_dir = getenv("HOME"); + const char* home_dir = getenv("HOME"); + if (!home_dir) { throw Exception("get home dir failed"); } path = home_dir; + path += "/."; + path += app_name; + + if (mkdir(path.c_str(), 0700) == -1 && errno != EEXIST) { + throw Exception("create appdata dir failed"); + } +} + +void Platform::path_append(std::string& path, const std::string& partial_path) +{ path += "/"; - path += SPICE_CONFIG_DIR; + path += partial_path; } static void root_win_proc(XEvent& event) |