saveload.c
changeset 3260 7d22aa47de3b
parent 3241 ffde1325bab8
child 3262 ac6619206ebe
--- a/saveload.c	Sat Mar 18 14:35:54 2006 +0000
+++ b/saveload.c	Sat Mar 18 15:55:24 2006 +0000
@@ -1314,6 +1314,12 @@
 extern void BeforeSaveGame(void);
 extern bool LoadOldSaveGame(const char *file);
 
+#ifdef UNIX
+extern const char *convert_to_fs_charset(const char *filename);
+#else
+#define convert_to_fs_charset(str) (str)
+#endif // UNIX
+
 /** Small helper function to close the to be loaded savegame an signal error */
 static inline SaveOrLoadResult AbortSaveLoad(void)
 {
@@ -1418,7 +1424,6 @@
 	save_thread = NULL;
 }
 
-
 /**
  * Main Save or Load function where the high-level saveload functions are
  * handled. It opens the savegame, selects format and checks versions
@@ -1449,7 +1454,11 @@
 		return SL_OK;
 	}
 
-	_sl.fh = fopen(filename, (mode == SL_SAVE) ? "wb" : "rb");
+	if(mode == SL_SAVE) {
+		_sl.fh = fopen(convert_to_fs_charset(filename), "wb");
+	} else {
+		_sl.fh = fopen(filename, "rb");
+	}
 	if (_sl.fh == NULL) {
 		DEBUG(misc, 0) ("[Sl] Cannot open savegame for saving/loading.");
 		return SL_ERROR;