Merge pull request #4 from Crestwave/haiku
Add support for Haiku's config directory
This commit is contained in:
commit
c68dd0b447
15
src/engine.c
15
src/engine.c
|
@ -22,9 +22,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#ifdef __HAIKU__
|
||||||
|
#include <FindDirectory.h>
|
||||||
|
#else
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "SDL.h"
|
#include "SDL.h"
|
||||||
|
|
||||||
|
@ -211,6 +215,17 @@ void engine_setupConfigDirectory()
|
||||||
if ((mkdir(dir) != 0) && (errno != EEXIST))
|
if ((mkdir(dir) != 0) && (errno != EEXIST))
|
||||||
engine_showError(2, dir);
|
engine_showError(2, dir);
|
||||||
|
|
||||||
|
snprintf(engine.configDirectory, PATH_MAX, "%s/", dir);
|
||||||
|
#elif __HAIKU__
|
||||||
|
subdir = "starfighter";
|
||||||
|
|
||||||
|
char path[PATH_MAX];
|
||||||
|
if (find_directory(B_USER_SETTINGS_DIRECTORY, 0, false, path, PATH_MAX) == B_OK)
|
||||||
|
snprintf(dir, PATH_MAX, "%s/%s", path, subdir);
|
||||||
|
|
||||||
|
if ((mkdir(dir, S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH) != 0) && (errno != EEXIST))
|
||||||
|
engine_showError(2, dir);
|
||||||
|
|
||||||
snprintf(engine.configDirectory, PATH_MAX, "%s/", dir);
|
snprintf(engine.configDirectory, PATH_MAX, "%s/", dir);
|
||||||
#else
|
#else
|
||||||
subdir = "starfighter";
|
subdir = "starfighter";
|
||||||
|
|
Loading…
Reference in New Issue