mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-17 09:10:08 +02:00
57 lines
1.5 KiB
Plaintext
57 lines
1.5 KiB
Plaintext
From 738b3b33c59f39f506793d1a2bca0eaae4e8ae7d Mon Sep 17 00:00:00 2001
|
|
From: David Karoly <david.karoly@outlook.com>
|
|
Date: Thu, 15 Dec 2022 17:36:32 +0100
|
|
Subject: adjust folders for Haiku
|
|
|
|
|
|
diff --git a/unix/storage.c b/unix/storage.c
|
|
index ca22573..df40613 100644
|
|
--- a/unix/storage.c
|
|
+++ b/unix/storage.c
|
|
@@ -20,6 +20,11 @@
|
|
#include "storage.h"
|
|
#include "tree234.h"
|
|
|
|
+#ifdef __HAIKU__
|
|
+#include <FindDirectory.h>
|
|
+#include <fs_info.h>
|
|
+#endif
|
|
+
|
|
#ifdef PATH_MAX
|
|
#define FNLEN PATH_MAX
|
|
#else
|
|
@@ -107,6 +112,15 @@ static char *make_filename(int index, const char *subname)
|
|
if (env && *env) {
|
|
xdg_dir = dupprintf("%s/putty", env);
|
|
}
|
|
+#ifdef __HAIKU__
|
|
+ if (!xdg_dir) {
|
|
+ char dir[B_PATH_NAME_LENGTH + B_FILE_NAME_LENGTH];
|
|
+ dev_t volume = dev_for_path("/boot");
|
|
+ if (find_directory(B_USER_SETTINGS_DIRECTORY, volume, false, dir, sizeof(dir)) == B_OK) {
|
|
+ xdg_dir = dupprintf("%s/putty", dir);
|
|
+ }
|
|
+ }
|
|
+#endif
|
|
if (!xdg_dir) {
|
|
if (home) {
|
|
tmp = home;
|
|
diff --git a/unix/utils/make_dir_path.c b/unix/utils/make_dir_path.c
|
|
index 4d212fe..87b8ead 100644
|
|
--- a/unix/utils/make_dir_path.c
|
|
+++ b/unix/utils/make_dir_path.c
|
|
@@ -16,6 +16,10 @@ char *make_dir_path(const char *path, mode_t mode)
|
|
int pos = 0;
|
|
char *prefix;
|
|
|
|
+ if (mkdir(path, mode) == 0) {
|
|
+ return NULL;
|
|
+ }
|
|
+
|
|
while (1) {
|
|
pos += strcspn(path + pos, "/");
|
|
|
|
--
|
|
2.37.3
|
|
|