unix: save config in home dir

pull/2/head
Nicolò Balzarotti 2016-12-26 15:53:04 +01:00
parent 37c6bbea0f
commit 85f0e821fe
1 changed files with 16 additions and 1 deletions

View File

@ -37,7 +37,22 @@ int main () {
keypad(stdscr, true);
srand (time(NULL));
fp = fopen ("roofus.txt", "a+");
char path[80];
#ifdef _WIN32
path = "roofus.txt";
#else
char *homedir;
homedir = getenv("HOME");
strcat(path, homedir);
strcat(path, "/.roofus");
#endif
fp = fopen (path, "a+");
if (fp == NULL) {
printw ("Error opening file");
refresh();