mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-08 21:00:05 +02:00
filezilla: use find_directory for XDG vars (#7525)
This commit is contained in:
@@ -260,37 +260,66 @@ index 7b16d8a..8b120b6 100644
|
||||
2.37.3
|
||||
|
||||
|
||||
From e307ee5d6125be25e9bd9f2d91310d7de40f01c4 Mon Sep 17 00:00:00 2001
|
||||
From a414cee31f8a6ab07087fe89ae2ecc3edfdbe116 Mon Sep 17 00:00:00 2001
|
||||
From: David Karoly <david.karoly@outlook.com>
|
||||
Date: Mon, 5 Dec 2022 23:03:41 +0100
|
||||
Subject: Haiku: initialize XDG vars
|
||||
|
||||
|
||||
diff --git a/src/interface/locale_initializer.cpp b/src/interface/locale_initializer.cpp
|
||||
index fac6aa7..bcb1476 100644
|
||||
index fac6aa7..7806c7f 100644
|
||||
--- a/src/interface/locale_initializer.cpp
|
||||
+++ b/src/interface/locale_initializer.cpp
|
||||
@@ -10,6 +10,10 @@
|
||||
@@ -10,6 +10,12 @@
|
||||
#include <locale.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
+#ifdef __HAIKU__
|
||||
+#include <FindDirectory.h>
|
||||
+#include <fs_info.h>
|
||||
+#include <glib.h>
|
||||
+#endif
|
||||
+
|
||||
std::wstring GetOwnExecutableDir();
|
||||
|
||||
struct t_fallbacks
|
||||
@@ -93,6 +97,14 @@ int main(int argc, char** argv)
|
||||
@@ -76,6 +82,30 @@ static std::string mkstr(const char* str)
|
||||
}
|
||||
}
|
||||
|
||||
+#ifdef __HAIKU__
|
||||
+void initialize_xdg_paths(void)
|
||||
+{
|
||||
+ char dir[B_PATH_NAME_LENGTH + B_FILE_NAME_LENGTH];
|
||||
+ char dirs[B_PATH_NAME_LENGTH + B_FILE_NAME_LENGTH];
|
||||
+ dev_t volume = dev_for_path("/boot");
|
||||
+
|
||||
+ if (find_directory(B_SYSTEM_SETTINGS_DIRECTORY, volume, false, dir, sizeof(dir)) == B_OK)
|
||||
+ g_setenv ("XDG_CONFIG_DIRS", dir, FALSE);
|
||||
+ if (find_directory(B_USER_NONPACKAGED_DATA_DIRECTORY, volume, false, dir, sizeof(dir)) == B_OK)
|
||||
+ g_setenv ("XDG_DATA_HOME", dir, FALSE);
|
||||
+ if (find_directory(B_USER_SETTINGS_DIRECTORY, volume, false, dir, sizeof(dir)) == B_OK)
|
||||
+ g_setenv ("XDG_CONFIG_HOME", dir, FALSE);
|
||||
+ if (find_directory(B_USER_CACHE_DIRECTORY, volume, false, dir, sizeof(dir)) == B_OK)
|
||||
+ g_setenv ("XDG_CACHE_HOME", dir, FALSE);
|
||||
+ if (find_directory(B_SYSTEM_DATA_DIRECTORY, volume, false, dir, sizeof(dir)) == B_OK &&
|
||||
+ find_directory(B_SYSTEM_NONPACKAGED_DATA_DIRECTORY, volume, false, dirs, sizeof(dirs)) == B_OK) {
|
||||
+ strcat(dirs, ":");
|
||||
+ strcat(dirs, dir);
|
||||
+ g_setenv ("XDG_DATA_DIRS", dirs, FALSE);
|
||||
+ }
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
std::string locale = CInitializer::GetLocaleOption();
|
||||
@@ -93,6 +123,10 @@ int main(int argc, char** argv)
|
||||
}
|
||||
}
|
||||
|
||||
+#ifdef __HAIKU__
|
||||
+ g_setenv ("XDG_CONFIG_DIRS", "/boot/system/settings", FALSE);
|
||||
+ g_setenv ("XDG_DATA_HOME", "/boot/home/config/non-packaged/data", FALSE);
|
||||
+ g_setenv ("XDG_CONFIG_HOME", "/boot/home/config/settings", FALSE);
|
||||
+ g_setenv ("XDG_CACHE_HOME", "/boot/home/config/cache", FALSE);
|
||||
+ g_setenv ("XDG_DATA_DIRS", "/boot/system/non-packaged/data:/boot/system/data", FALSE);
|
||||
+ initialize_xdg_paths();
|
||||
+#endif
|
||||
+
|
||||
return wxEntry(argc, argv);
|
||||
|
||||
Reference in New Issue
Block a user