diff --git a/main.cpp b/main.cpp
index 2e05d9b..f987595 100644
--- a/main.cpp
+++ b/main.cpp
@@ -15,6 +15,10 @@
* along with this program. If not, see .
*/
+#include
+#include
+#include
+
#include "file.h"
#include "fs.h"
#include "game.h"
@@ -24,10 +28,10 @@ static const char *USAGE =
"REminiscence - Flashback Interpreter\n"
"Usage: %s [OPTIONS]...\n"
" --datapath=PATH Path to data files (default 'DATA')\n"
- " --savepath=PATH Path to save files (default '.')\n"
+ " --savepath=PATH Path to save files (default '~/.reminiscence/')\n"
" --levelnum=NUM Starting level (default '0')";
-static bool parseOption(const char *arg, const char *longCmd, const char **opt) {
+static bool parseOption(char *arg, const char *longCmd, char **opt) {
bool handled = false;
if (arg[0] == '-' && arg[1] == '-') {
if (strncmp(arg + 2, longCmd, strlen(longCmd)) == 0) {
@@ -83,9 +87,19 @@ static Language detectLanguage(FileSystem *fs) {
#undef main
int main(int argc, char *argv[]) {
- const char *dataPath = "DATA";
- const char *savePath = ".";
- const char *levelNum = "0";
+ struct stat sb;
+ char *dataPath = "DATA";
+ char *savePath = (char *)malloc(256);
+
+ snprintf(savePath, 255, "%s/.reminiscence", getenv("HOME"));
+
+ if (stat(savePath, &sb)) {
+ if (mkdir(savePath, 0755) == -1) {
+ error("Unable to create %s directory", savePath);
+ }
+ }
+
+ char *levelNum = "0";
for (int i = 1; i < argc; ++i) {
bool opt = false;
if (strlen(argv[i]) >= 2) {