diff -ru fargoal.orig/src/config.c fargoal/src/config.c --- fargoal.orig/src/config.c 2003-07-31 10:06:51.000000000 -0700 +++ fargoal/src/config.c 2004-01-23 23:42:56.000000000 -0800 @@ -6,7 +6,7 @@ void save_settings (void) { - set_config_file ("data/settings.cfg"); + set_config_file ("./settings.cfg"); set_config_int ("SOF", "colordepth", colordepth); set_config_int ("SOF", "fullscreen", fullscreen); set_config_int ("SOF", "scheme", scheme); @@ -27,7 +27,7 @@ void load_settings (void) { - set_config_file ("data/settings.cfg"); + set_config_file ("./settings.cfg"); colordepth = get_config_int ("SOF", "colordepth", desktop_color_depth ()); fullscreen = get_config_int ("SOF", "fullscreen", 0); scheme = get_config_int ("SOF", "scheme", 0); diff -ru fargoal.orig/src/main.c fargoal/src/main.c --- fargoal.orig/src/main.c 2003-07-31 10:06:51.000000000 -0700 +++ fargoal/src/main.c 2004-01-23 23:50:26.000000000 -0800 @@ -2,6 +2,9 @@ #include #include #include +#include +#include +#include #include "main.h" #include "game.h" @@ -334,6 +337,18 @@ exit (0); } + if (!getenv("HOME")) { + fprintf (stderr, "Environment variable HOME not set. Exiting."); + exit(1); + } + chdir(getenv("HOME")); + /* Don't check the return here because it may already exist. */ + mkdir(".fargoal", 0744); + if (chdir(".fargoal") != 0) { + fprintf (stderr, "Failed to change directories to ~/.fargoal"); + exit(1); + } + allegro_init (); srand ((unsigned) time (NULL)); @@ -442,7 +457,7 @@ #endif } - remove ("data/last.log"); + remove ("./last.log"); save_settings (); run_exit (); diff -ru fargoal.orig/src/menu.c fargoal/src/menu.c --- fargoal.orig/src/menu.c 2003-07-31 10:06:51.000000000 -0700 +++ fargoal/src/menu.c 2004-01-23 23:53:48.000000000 -0800 @@ -265,8 +265,8 @@ message (FPS / 2, NULL, "Quest %i selected!!", menu_selected - 1); - set_config_file ("data/settings.cfg"); - sprintf (str, "data/save%i.dat", quest_number); + set_config_file ("./settings.cfg"); + sprintf (str, "./save%i.dat", quest_number); sprintf (entry, "Beginning"); set_config_string ("SOF", str, entry); @@ -305,8 +305,8 @@ if (menu_selected >= 2 && menu_selected <= 10) { char str[100]; - set_config_file ("data/settings.cfg"); - sprintf (str, "data/save%i.dat", menu_selected - 1); + set_config_file ("./settings.cfg"); + sprintf (str, "./save%i.dat", menu_selected - 1); if (!get_config_string ("SOF", str, NULL)) { @@ -346,8 +346,8 @@ if (menu_selected >= 2 && menu_selected <= 10) { char str[100]; - set_config_file ("data/settings.cfg"); - sprintf (str, "data/save%i.dat", menu_selected - 1); + set_config_file ("./settings.cfg"); + sprintf (str, "./save%i.dat", menu_selected - 1); if (game_delete (menu_selected - 1) || get_config_string ("SOF", str, NULL)) { @@ -653,7 +653,7 @@ int i; char str[100]; - set_config_file ("data/settings.cfg"); + set_config_file ("./settings.cfg"); if (!notrunning) { @@ -662,14 +662,14 @@ list[1].current_level, list[1].lev, won ? "won" : gameover ? "dead" : swordrun ? "running out of time" : "alive"); game_save (quest_number); - sprintf (str, "data/save%i.dat", quest_number); + sprintf (str, "./save%i.dat", quest_number); set_config_string ("SOF", str, entry); } for (i = 0; i < 9; i++) { char const *entry; - sprintf (str, "data/save%i.dat", i + 1); + sprintf (str, "./save%i.dat", i + 1); entry = get_config_string ("SOF", str, "empty"); sprintf (savenames[i], "%i: %s", i + 1, entry); menu_delete_text[2 + i] = savenames[i]; diff -ru fargoal.orig/src/message.c fargoal/src/message.c --- fargoal.orig/src/message.c 2003-07-31 10:06:51.000000000 -0700 +++ fargoal/src/message.c 2004-01-23 23:51:12.000000000 -0800 @@ -79,11 +79,11 @@ if (filename) { - file_copy (filename, "data/last.log", 0); - messagefile = fopen ("data/last.log", "a"); + file_copy (filename, "./last.log", 0); + messagefile = fopen ("./last.log", "a"); } else - messagefile = fopen ("data/last.log", "w"); + messagefile = fopen ("./last.log", "w"); } /* Copy current messages to given file. */ @@ -93,9 +93,9 @@ if (messagefile) fclose (messagefile); - file_copy ("data/last.log", filename, 1); + file_copy ("./last.log", filename, 1); - messagefile = fopen ("data/last.log", "a"); + messagefile = fopen ("./last.log", "a"); } static void diff -ru fargoal.orig/src/save.c fargoal/src/save.c --- fargoal.orig/src/save.c 2003-07-31 10:06:51.000000000 -0700 +++ fargoal/src/save.c 2004-01-23 23:52:11.000000000 -0800 @@ -253,7 +253,7 @@ char name[256]; PACKFILE *file; - sprintf (name, "data/save%i.dat", nr); + sprintf (name, "./save%i.dat", nr); file = pack_fopen (name, "wp"); if (file) @@ -297,7 +297,7 @@ pack_fclose (file); - sprintf (name, "data/save%i.html", nr); + sprintf (name, "./save%i.html", nr); messages_exit (name); return 1; @@ -311,7 +311,7 @@ char name[256]; PACKFILE *file; - sprintf (name, "data/save%i.dat", nr); + sprintf (name, "./save%i.dat", nr); file = pack_fopen (name, "rp"); if (file) @@ -356,7 +356,7 @@ pack_fclose (file); - sprintf (name, "data/save%i.html", nr); + sprintf (name, "./save%i.html", nr); messages_init (name); return 1; } @@ -368,10 +368,10 @@ { int ret = 1; char name[256]; - sprintf (name, "data/save%i.dat", nr); + sprintf (name, "./save%i.dat", nr); if (remove (name)) ret = 0; - sprintf (name, "data/save%i.html", nr); + sprintf (name, "./save%i.html", nr); if (remove (name)) ret = 0; return ret;