summaryrefslogtreecommitdiff
path: root/xkb
diff options
context:
space:
mode:
authorAlexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de>2004-11-22 15:00:04 +0000
committerAlexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de>2004-11-22 15:00:04 +0000
commitbb43f234c5d418e064c89b928b81b53987f14e92 (patch)
treec3d0eb3a5a96e09217b8232ed0633d246cb06b23 /xkb
parentbc7493801d1f5177d9ba3fe09accc2a2d72cfe3d (diff)
Use GetTempPath for finding a place where to store temporary files on
Windows
Diffstat (limited to 'xkb')
-rw-r--r--xkb/ddxLoad.c17
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";
}