(svn r19151) -Codechange [FS#3625]: Move home directory to a better place in Haiku (jrepan)

This commit is contained in:
rubidium 2010-02-17 16:45:55 +00:00
parent 9f27959fcd
commit ef90fa7d02
3 changed files with 11 additions and 2 deletions

View File

@ -1018,7 +1018,7 @@ check_params() {
fi fi
if [ "$personal_dir" = "1" ]; then if [ "$personal_dir" = "1" ]; then
if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "WINCE" ] || [ "$os" = "DOS" ]; then if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "WINCE" ] || [ "$os" = "DOS" ] || [ "$os" == "HAIKU" ]; then
personal_dir="OpenTTD" personal_dir="OpenTTD"
elif [ "$os" = "OSX" ]; then elif [ "$os" = "OSX" ]; then
personal_dir="Documents/OpenTTD" personal_dir="Documents/OpenTTD"

View File

@ -16,7 +16,7 @@
* *
* \b 1.1.0 * \b 1.1.0
* *
* 1.0.0 is not yet released. The following changes are not set in stone yet. * 1.1.0 is not yet released. The following changes are not set in stone yet.
* *
* \b 1.0.0 * \b 1.0.0
* *

View File

@ -18,6 +18,9 @@
#include "tar_type.h" #include "tar_type.h"
#ifdef WIN32 #ifdef WIN32
#include <windows.h> #include <windows.h>
#elif defined(__HAIKU__)
#include <Path.h>
#include <storage/FindDirectory.h>
#else #else
#ifdef OPENBSD #ifdef OPENBSD
#include <unistd.h> #include <unistd.h>
@ -848,6 +851,11 @@ void DetermineBasePaths(const char *exe)
char tmp[MAX_PATH]; char tmp[MAX_PATH];
#if defined(__MORPHOS__) || defined(__AMIGA__) || defined(DOS) || defined(OS2) || !defined(WITH_PERSONAL_DIR) #if defined(__MORPHOS__) || defined(__AMIGA__) || defined(DOS) || defined(OS2) || !defined(WITH_PERSONAL_DIR)
_searchpaths[SP_PERSONAL_DIR] = NULL; _searchpaths[SP_PERSONAL_DIR] = NULL;
#else
#ifdef __HAIKU__
BPath path;
find_directory(B_USER_SETTINGS_DIRECTORY, &path);
const char *homedir = path.Path();
#else #else
const char *homedir = getenv("HOME"); const char *homedir = getenv("HOME");
@ -855,6 +863,7 @@ void DetermineBasePaths(const char *exe)
const struct passwd *pw = getpwuid(getuid()); const struct passwd *pw = getpwuid(getuid());
homedir = (pw == NULL) ? "" : pw->pw_dir; homedir = (pw == NULL) ? "" : pw->pw_dir;
} }
#endif
snprintf(tmp, MAX_PATH, "%s" PATHSEP "%s", homedir, PERSONAL_DIR); snprintf(tmp, MAX_PATH, "%s" PATHSEP "%s", homedir, PERSONAL_DIR);
AppendPathSeparator(tmp, MAX_PATH); AppendPathSeparator(tmp, MAX_PATH);