foxygit / doom Log in
commit 0e3e4653f8df775fdd41e18e956f465fd334f275
Author:     Simon Howard <fraggle@gmail.com>
AuthorDate: Sun Jun 7 17:53:25 2009 +0000
Commit:     Simon Howard <fraggle@gmail.com>
CommitDate: Sun Jun 7 17:53:25 2009 +0000

    Use home dir to store configuration and savegames under Windows CE.

    Subversion-branch: /trunk/chocolate-doom
    Subversion-revision: 1573
---
 setup/configfile.c | 15 +++++++++------
 src/m_config.c     | 10 ++++++----
 2 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/setup/configfile.c b/setup/configfile.c
index 5013e3ce..3714a35f 100644
--- a/setup/configfile.c
+++ b/setup/configfile.c
@@ -74,7 +74,7 @@ void M_MakeDirectory(char *path)


 //
-// SetConfigDir:
+// M_SetConfigDir:
 //
 // Sets the location of the configuration directory, where configuration
 // files are stored - default.cfg, chocolate-doom.cfg, savegames, etc.
@@ -82,9 +82,11 @@ void M_MakeDirectory(char *path)

 void M_SetConfigDir(void)
 {
-#ifndef _WIN32
-    // Ignore the HOME environment variable on Windows - just behave
-    // like Vanilla Doom.
+#if !defined(_WIN32) || defined(_WIN32_WCE)
+
+    // Configuration settings are stored in ~/.chocolate-doom/,
+    // except on Windows, where we behave like Vanilla Doom and
+    // save in the current directory.

     char *homedir;

@@ -97,7 +99,8 @@ void M_SetConfigDir(void)

         configdir = malloc(strlen(homedir) + strlen(PACKAGE_TARNAME) + 5);

-        sprintf(configdir, "%s/.%s/", homedir, PACKAGE_TARNAME);
+        sprintf(configdir, "%s%c.%s%c", homedir, DIR_SEPARATOR,
+			                PACKAGE_TARNAME, DIR_SEPARATOR);

         // make the directory if it doesnt already exist

@@ -106,7 +109,7 @@ void M_SetConfigDir(void)
     else
 #endif /* #ifndef _WIN32 */
     {
-#ifdef _WIN32
+#if defined(_WIN32) && !defined(_WIN32_WCE)
         // when given the -cdrom option, save config+savegames in
         // c:\doomdata.  This only applies under Windows.

diff --git a/src/m_config.c b/src/m_config.c
index be329cba..5bc46ca3 100644
--- a/src/m_config.c
+++ b/src/m_config.c
@@ -1313,9 +1313,11 @@ void M_LoadDefaults (void)

 void M_SetConfigDir(void)
 {
-#ifndef _WIN32
-    // Ignore the HOME environment variable on Windows - just behave
-    // like Vanilla Doom.
+#if !defined(_WIN32) || defined(_WIN32_WCE)
+
+    // Configuration settings are stored in ~/.chocolate-doom/,
+    // except on Windows, where we behave like Vanilla Doom and
+    // save in the current directory.

     char *homedir;

@@ -1338,7 +1340,7 @@ void M_SetConfigDir(void)
     else
 #endif /* #ifndef _WIN32 */
     {
-#ifdef _WIN32
+#if defined(_WIN32) && !defined(_WIN32_WCE)
         //!
         // @platform windows
         // @vanilla