Author: cazfi
Date: Sun Jul  3 09:24:43 2016
New Revision: 33152

URL: http://svn.gna.org/viewcvs/freeciv?rev=33152&view=rev
Log:
Keep native dir separator for Windows home dir definition

See patch #7365

Modified:
    branches/S2_6/utility/shared.c

Modified: branches/S2_6/utility/shared.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/utility/shared.c?rev=33152&r1=33151&r2=33152&view=diff
==============================================================================
--- branches/S2_6/utility/shared.c      (original)
+++ branches/S2_6/utility/shared.c      Sun Jul  3 09:24:43 2016
@@ -638,7 +638,7 @@
       log_verbose("HOME is %s", home_dir);
     } else {
 
-#ifdef WIN32_NATIVE
+#ifdef FREECIV_MSWINDOWS
 
       /* some documentation at:
        * 
http://justcheckingonall.wordpress.com/2008/05/16/find-shell-folders-win32/
@@ -654,6 +654,19 @@
           /* convert to internal encoding */
           home_dir = 
local_to_internal_string_malloc(home_dir_in_local_encoding);
           free(home_dir_in_local_encoding);
+
+#ifdef DIR_SEPARATOR_IS_DEFAULT
+          /* replace backslashes with forward slashes */
+          {
+            char *c;
+
+            for (c = home_dir; *c != 0; c++) {
+              if (*c == '\\') {
+                *c = DIR_SEPARATOR_CHAR;
+              }
+            }
+          }
+#endif /* DIR_SEPARATOR_IS_DEFAULT */
         } else {
           free(home_dir_in_local_encoding);
           home_dir = NULL;
@@ -671,10 +684,10 @@
         log_error("Could not find home directory "
                   "(SHGetSpecialFolderLocation() failed).");
       }
-#else  /* WIN32_NATIVE */
+#else  /* FREECIV_MSWINDOWS */
       log_error("Could not find home directory (HOME is not set).");
       home_dir = NULL;
-#endif /* WIN32_NATIVE */
+#endif /* FREECIV_MSWINDOWS */
     }
   }
 


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to