unix: save config in home dir
parent
37c6bbea0f
commit
85f0e821fe
17
Roofus.c
17
Roofus.c
|
@ -37,7 +37,22 @@ int main () {
|
||||||
keypad(stdscr, true);
|
keypad(stdscr, true);
|
||||||
|
|
||||||
srand (time(NULL));
|
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) {
|
if (fp == NULL) {
|
||||||
printw ("Error opening file");
|
printw ("Error opening file");
|
||||||
refresh();
|
refresh();
|
||||||
|
|
Loading…
Reference in New Issue