$OpenBSD: patch-src_Savegame_SavedGame_cpp,v 1.1 2011/07/18 10:57:01 jasper Exp $
--- src/Savegame/SavedGame.cpp.orig	Sat Jun  4 00:04:45 2011
+++ src/Savegame/SavedGame.cpp	Mon Jul  4 22:45:13 2011
@@ -22,6 +22,7 @@
 #include <iomanip>
 #include "../dirent.h"
 #include "yaml.h"
+#include "../File/File.h"
 #include "../Ruleset/Ruleset.h"
 #include "../Engine/RNG.h"
 #include "../Engine/Language.h"
@@ -37,6 +38,12 @@
 #include "Waypoint.h"
 #include "UfopaediaSaved.h"
 
+#ifndef _WIN32
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/param.h>
+#endif
+
 namespace OpenXcom
 {
 
@@ -89,14 +96,15 @@ SavedGame::~SavedGame()
  */
 void SavedGame::getList(TextList *list, Language *lang)
 {
-	DIR *dp = opendir(USER_DIR);
-    if (dp == 0)
+	File fileobj;
+	DIR *dp = opendir(fileobj.getSavegameDir().c_str());
+	if (dp == 0)
 	{
-        throw Exception("Failed to open saves directory");
-    }
+		throw Exception("Failed to open saves directory");
+	}
 
-    struct dirent *dirp;
-    while ((dirp = readdir(dp)) != 0)
+	struct dirent *dirp;
+	while ((dirp = readdir(dp)) != 0)
 	{
 		std::string file = dirp->d_name;
 		// Check if it's a valid save
@@ -104,7 +112,7 @@ void SavedGame::getList(TextList *list, Language *lang
 		{
 			continue;
 		}
-		std::string fullname = USER_DIR + file;
+		std::string fullname = fileobj.getSavegameDir() + file;
 		std::ifstream fin(fullname.c_str());
 		if (!fin)
 		{
@@ -125,8 +133,8 @@ void SavedGame::getList(TextList *list, Language *lang
 		saveYear << time.getYear();
 		list->addRow(5, Language::utf8ToWstr(file.substr(0, file.length()-4)).c_str(), Language::utf8ToWstr(saveTime.str()).c_str(), saveDay.str().c_str(), saveMonth.str().c_str(), saveYear.str().c_str());
 		fin.close();
-    }
-    closedir(dp);
+	}
+	closedir(dp);
 }
 
 /**
@@ -138,8 +146,9 @@ void SavedGame::getList(TextList *list, Language *lang
 void SavedGame::load(const std::string &filename, Ruleset *rule)
 {
 	unsigned int size = 0;
+	File file;
 
-	std::string s = USER_DIR + filename + ".sav";
+	std::string s = file.getSavegameDir() + filename + ".sav";
 	std::ifstream fin(s.c_str());
 	if (!fin)
 	{
@@ -231,7 +240,8 @@ void SavedGame::load(const std::string &filename, Rule
  */
 void SavedGame::save(const std::string &filename) const
 {
-	std::string s = USER_DIR + filename + ".sav";
+	File file;
+	std::string s = file.getSavegameDir() + filename + ".sav";
 	std::ofstream sav(s.c_str());
 	if (!sav)
 	{
