|
|
@@ -229,16 +229,19 @@ find_root_dir_default() {
|
|
|
return root;
|
|
|
}
|
|
|
|
|
|
-#else // The Linux case
|
|
|
+#else // The Linux/*BSD case
|
|
|
// e.g., /home/<username>/.panda3d
|
|
|
|
|
|
string root;
|
|
|
- const char *uname = getlogin();
|
|
|
- if (uname == NULL) uname = getenv("USER");
|
|
|
-
|
|
|
- const passwd *pwdata = getpwnam(uname);
|
|
|
+ const passwd *pwdata = getpwuid(getuid());
|
|
|
if (pwdata == NULL) {
|
|
|
- root = getenv("HOME");
|
|
|
+ char *home = getenv("HOME");
|
|
|
+ if (home == NULL) {
|
|
|
+ // Beh. Let's hope it never gets to this point.
|
|
|
+ return ".";
|
|
|
+ } else {
|
|
|
+ root = home;
|
|
|
+ }
|
|
|
} else {
|
|
|
root = pwdata->pw_dir;
|
|
|
}
|