From bb2a8884e394094da40f82886eacb21c1f798eaf Mon Sep 17 00:00:00 2001 From: Björn Steinbrink Date: Tue, 2 Aug 2005 22:12:08 +0000 Subject: Use PhysFS to determine user's home directory on unix. Removed an now unused header. --- ChangeLog | 5 +++++ src/main.cpp | 15 +-------------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index f45feaa8..14a83841 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-08-03 Björn Steinbrink + + * src/main.cpp: Use PhysFS to determine user's home directory on unix + system. Removed an now unused header. + 2005-08-02 Andrej Sinicyn * src/game.cpp: Fixed "Trade canceled" happening often. diff --git a/src/main.cpp b/src/main.cpp index c2ea4886..8e068601 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -46,9 +46,6 @@ #include #include #include -#ifdef USE_OPENGL -#include -#endif #include #ifdef __USE_UNIX98 @@ -140,19 +137,9 @@ void init_engine() // In Windows and other systems we currently store data next to executable. homeDir = "."; #else - // But, in UNIX we store data in ~/.tmw/ - passwd *pass = getpwuid(geteuid()); - - if (pass == NULL || pass->pw_dir == NULL) { - std::cout << "Couldn't determine the user home directory. Exitting." << std::endl; - exit(1); - } + homeDir = std::string(PHYSFS_getUserDir()) + "/.tmw"; // Checking if /home/user/.tmw folder exists. - - homeDir = pass->pw_dir; - homeDir += "/.tmw"; - //sprintf(homeDir, "%s/.tmw", pass->pw_dir); if ((mkdir(homeDir.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) != 0) && (errno != EEXIST)) { -- cgit v1.2.3-70-g09d2