diff options
Diffstat (limited to 'chinese/sunpinyin/files/patch-xdg')
-rw-r--r-- | chinese/sunpinyin/files/patch-xdg | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/chinese/sunpinyin/files/patch-xdg b/chinese/sunpinyin/files/patch-xdg new file mode 100644 index 000000000000..452c3aacb46f --- /dev/null +++ b/chinese/sunpinyin/files/patch-xdg @@ -0,0 +1,35 @@ +--- src/ime-core/imi_options.cpp.orig 2014-11-14 14:17:48 UTC ++++ src/ime-core/imi_options.cpp +@@ -73,12 +73,15 @@ CSimplifiedChinesePolicy::loadResources( + + if (!m_user_data_dir.size()) { + char path[256]; +- const char *home = getenv("HOME"); +- snprintf(path, +- sizeof(path), +- "%s/%s", +- home, +- SUNPINYIN_USERDATA_DIR_PREFIX); ++ const char *home = getenv("XDG_CONFIG_HOME"); ++ if (home == NULL) ++ snprintf(path, sizeof(path), ++ "%s/.config/%s", getenv("HOME"), ++ SUNPINYIN_USERDATA_DIR_PREFIX); ++ else ++ snprintf(path, sizeof(path), ++ "%s/%s", home, ++ SUNPINYIN_USERDATA_DIR_PREFIX); + m_user_data_dir = path; + } + +--- src/ime-core/imi_options.h.orig 2014-11-14 14:17:48 UTC ++++ src/ime-core/imi_options.h +@@ -52,7 +52,7 @@ + #include "pinyin/hunpin_seg.h" + + #ifndef SUNPINYIN_USERDATA_DIR_PREFIX +-#define SUNPINYIN_USERDATA_DIR_PREFIX ".sunpinyin" ++#define SUNPINYIN_USERDATA_DIR_PREFIX "sunpinyin" + #endif + + struct CSimplifiedChinesePolicy : public IConfigurable { |