Files
haikuports/app-text/libnumbertext/patches/libnumbertext-1.0.6.patchset
2020-09-01 13:22:05 +10:00

40 lines
1.2 KiB
Plaintext

From 84705e6d45361b1b1f61db4a4e7023f942b0ac0f Mon Sep 17 00:00:00 2001
From: Kacper Kasper <kacperkasper@gmail.com>
Date: Fri, 3 Aug 2018 20:05:18 +0200
Subject: Haiku support
diff --git a/src/spellout.cxx b/src/spellout.cxx
index d287e66..7bd4aa8 100644
--- a/src/spellout.cxx
+++ b/src/spellout.cxx
@@ -1,6 +1,10 @@
#include "Numbertext.hxx"
#include "numbertext-version.h"
#include <cstring>
+#ifdef __HAIKU__
+#include <fs_info.h>
+#include <FindDirectory.h>
+#endif
#ifdef HAVE_BOOST_REGEX
using namespace boost;
@@ -40,6 +44,14 @@ int main(int argc, char* argv[])
paths.emplace_back("");
paths.emplace_back(DEFPATH);
paths.emplace_back(DEFPATH2);
+#ifdef __HAIKU__
+ dev_t volume = dev_for_path("/boot");
+ char buffer[B_PATH_NAME_LENGTH+B_FILE_NAME_LENGTH];
+ find_directory(B_SYSTEM_DATA_DIRECTORY, volume, false, buffer, sizeof(buffer));
+ paths.emplace_back(std::string(buffer) + "/libnumbertext/");
+ find_directory(B_USER_DATA_DIRECTORY, volume, false, buffer, sizeof(buffer));
+ paths.emplace_back(std::string(buffer) + "/libnumbertext/");
+#endif
if (getenv(PATH))
paths.insert(paths.begin() + 1, std::string(getenv(PATH)) + "/");
--
2.28.0