diff options
Diffstat (limited to 'xkb')
-rw-r--r-- | xkb/ddxLoad.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/xkb/ddxLoad.c b/xkb/ddxLoad.c index f0b942322..e5ef0bfeb 100644 --- a/xkb/ddxLoad.c +++ b/xkb/ddxLoad.c @@ -77,11 +77,22 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. static const char* Win32TempDir() { - if (getenv("TEMP") != NULL) + static char buffer[MAX_PATH]; + int len; + if (GetTempPath(sizeof(buffer), buffer)) + { + buffer[sizeof(buffer)-1] = 0; + len = strlen(buffer); + if (len > 0) + if (buffer[len-1] == '\\') + buffer[len-1] = 0; + return buffer; + } + if (getenv("TEMP") != NULL) return getenv("TEMP"); - else if (getenv("TMP") != NULL) + else if (getenv("TMP") != NULL) return getenv("TEMP"); - else + else return "/tmp"; } |