Spell-checked most of the code.
[neverball] / share / base_config.c
index 5124339..d7f751d 100644 (file)
@@ -13,7 +13,6 @@
  */
 
 #include <SDL.h>
-#include <SDL_mixer.h>
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
@@ -86,8 +85,8 @@ const char *config_user(const char *file)
 
 /*
  * Attempt to find  the game data directory.  Search  the command line
- * paramater,  the environment,  and the  hard-coded default,  in that
- * order.  Confirm it by checking for presense of the named file.
+ * parameter,  the environment,  and the  hard-coded default,  in that
+ * order.  Confirm it by checking for presence of the named file.
  */
 int config_data_path(const char *path, const char *file)
 {
@@ -120,13 +119,13 @@ int config_data_path(const char *path, const char *file)
  * replays.
  *
  * HACK: under Windows just assume the user has permission to write to
- * the data  directory.  This is  more reliable than trying  to devine
+ * the data  directory.  This is  more reliable than trying  to divine
  * anything reasonable from the environment.
  */
 int config_user_path(const char *file)
 {
 #ifdef _WIN32
-    size_t d = strlen(CONFIG_USER);
+    size_t d = strlen(data_path);
 
     strncpy(user_path, data_path,   MAXSTR - 1);
     strncat(user_path, "\\",        MAXSTR - d - 1);
@@ -142,9 +141,9 @@ int config_user_path(const char *file)
     {
         size_t d = strlen(dir);
 
-        strncpy(user_path, getenv("HOME"), MAXSTR - 1);
-        strncat(user_path, "/",            MAXSTR - d - 1);
-        strncat(user_path, CONFIG_USER,    MAXSTR - d - 2);
+        strncpy(user_path, dir,         MAXSTR - 1);
+        strncat(user_path, "/",         MAXSTR - d - 1);
+        strncat(user_path, CONFIG_USER, MAXSTR - d - 2);
     }
 
     if ((mkdir(user_path, 0777) == 0) || (errno = EEXIST))