From 595569fc63ccbf57ee14c45785eaea83dd497d43 Mon Sep 17 00:00:00 2001 From: David Karoly Date: Sat, 19 Nov 2022 13:44:51 +0100 Subject: configure: detect -lnetwork diff --git a/configure.ac b/configure.ac index 15d103a..ac1dc3d 100644 --- a/configure.ac +++ b/configure.ac @@ -282,7 +282,7 @@ if test "$buildmain" = "yes"; then #include #include ]) - AC_SEARCH_LIBS([socket], [xnet]) + AC_SEARCH_LIBS([socket], [network xnet]) AC_SEARCH_LIBS([getaddrinfo], [xnet]) AC_SEARCH_LIBS([in6addr_loopback], [socket]) -- 2.51.0 From 425a172bc5e2f1af67c5fb7961c6f845ad6594ec Mon Sep 17 00:00:00 2001 From: David Karoly Date: Wed, 1 Mar 2023 21:55:23 +0100 Subject: configure: check for wordexp.h diff --git a/configure.ac b/configure.ac index ac1dc3d..336a390 100644 --- a/configure.ac +++ b/configure.ac @@ -282,6 +282,8 @@ if test "$buildmain" = "yes"; then #include #include ]) + AC_CHECK_HEADERS([wordexp.h]) + AC_SEARCH_LIBS([socket], [network xnet]) AC_SEARCH_LIBS([getaddrinfo], [xnet]) AC_SEARCH_LIBS([in6addr_loopback], [socket]) diff --git a/src/commonui/fz_paths.cpp b/src/commonui/fz_paths.cpp index 8654100..defef25 100644 --- a/src/commonui/fz_paths.cpp +++ b/src/commonui/fz_paths.cpp @@ -15,8 +15,10 @@ #include #else #include +#ifdef HAVE_WORDEXP_H #include #endif +#endif using namespace std::literals; -- 2.51.0 From 93b80e44cf41929d64848fcfebc5727882c6a278 Mon Sep 17 00:00:00 2001 From: David Karoly Date: Fri, 3 Mar 2023 14:36:17 +0100 Subject: Fallback to glob if wordexp is not available. Inspired by OpenBSD downstream patch. diff --git a/configure.ac b/configure.ac index 336a390..da5a21e 100644 --- a/configure.ac +++ b/configure.ac @@ -282,8 +282,12 @@ if test "$buildmain" = "yes"; then #include #include ]) + AC_CHECK_HEADERS([glob.h]) AC_CHECK_HEADERS([wordexp.h]) + AC_CHECK_FUNCS([glob]) + AC_CHECK_FUNCS([wordexp]) + AC_SEARCH_LIBS([socket], [network xnet]) AC_SEARCH_LIBS([getaddrinfo], [xnet]) AC_SEARCH_LIBS([in6addr_loopback], [socket]) diff --git a/src/commonui/fz_paths.cpp b/src/commonui/fz_paths.cpp index defef25..7659337 100644 --- a/src/commonui/fz_paths.cpp +++ b/src/commonui/fz_paths.cpp @@ -15,6 +15,9 @@ #include #else #include +#ifdef HAVE_GLOB_H + #include +#endif #ifdef HAVE_WORDEXP_H #include #endif @@ -496,6 +499,8 @@ char const* GetDownloadDirImpl(); #elif !defined(FZ_WINDOWS) namespace { + +#if defined(HAVE_WORDEXP) std::string ShellUnescape(std::string const& path) { std::string ret; @@ -509,6 +514,26 @@ std::string ShellUnescape(std::string const& path) return ret; } +#elif defined(HAVE_GLOB) +std::string ShellUnescape(std::string const& path) +{ + std::string ret; + + glob_t p; + int res = glob(path.c_str(), GLOB_ERR, NULL, &p); + if (!res && p.gl_pathc == 1 && p.gl_pathv) { + ret = p.gl_pathv[0]; + } + globfree(&p); + + return ret; +} +#else +std::string ShellUnescape(std::string const& path) +{ + return path; +} +#endif size_t next_line(fz::file& f, fz::buffer& buf, size_t maxlen = 16 * 1024) { -- 2.51.0 From be04ff12c786031cd41b0653ec12448e29e86c42 Mon Sep 17 00:00:00 2001 From: David Karoly Date: Sat, 19 Nov 2022 13:44:51 +0100 Subject: adjust folders for Haiku diff --git a/src/commonui/Makefile.am b/src/commonui/Makefile.am index cf74a26..a703cf1 100644 --- a/src/commonui/Makefile.am +++ b/src/commonui/Makefile.am @@ -5,6 +5,7 @@ lib_LTLIBRARIES = libfzclient-commonui-private.la libfzclient_commonui_private_la_CPPFLAGS = -I$(top_builddir)/config libfzclient_commonui_private_la_CPPFLAGS += $(LIBFILEZILLA_CFLAGS) libfzclient_commonui_private_la_CPPFLAGS += -DBUILDING_FZ_COMMONUI +libfzclient_commonui_private_la_CPPFLAGS += -DDATADIR='L"$(datadir)"' libfzclient_commonui_private_la_CXXFLAGS = -fvisibility=hidden libfzclient_commonui_private_la_LDFLAGS = -no-undefined -release $(PACKAGE_VERSION_MAJOR).$(PACKAGE_VERSION_MINOR).$(PACKAGE_VERSION_MICRO) diff --git a/src/commonui/fz_paths.cpp b/src/commonui/fz_paths.cpp index 7659337..4ae39d3 100644 --- a/src/commonui/fz_paths.cpp +++ b/src/commonui/fz_paths.cpp @@ -297,6 +297,19 @@ CLocalPath GetFZDataDir(std::vector const& fileToFind, std::wstrin } } +#ifdef DATADIR + std::wstring dataDir(DATADIR); + if (testPath(dataDir)) { + return ret; + } + + if (!prefixSub.empty()) { + if (testPath(dataDir + L_DIR_SEP + prefixSub)) { + return ret; + } + } +#endif + std::wstring selfDir = GetOwnExecutableDir(); if (!selfDir.empty()) { if (searchSelfDir && testPath(selfDir)) { @@ -359,7 +372,7 @@ CLocalPath GetDefaultsDir() #endif if (path.empty()) { - path = GetFZDataDir({ L"fzdefaults.xml" }, L"share/filezilla"); + path = GetFZDataDir({ L"fzdefaults.xml" }, L"filezilla"); } return path; }(); diff --git a/src/interface/FileZilla.cpp b/src/interface/FileZilla.cpp index 01dffce..da2d725 100644 --- a/src/interface/FileZilla.cpp +++ b/src/interface/FileZilla.cpp @@ -300,7 +300,7 @@ int CFileZillaApp::OnExit() bool CFileZillaApp::LoadResourceFiles() { AddStartupProfileRecord("CFileZillaApp::LoadResourceFiles"sv); - m_resourceDir = GetFZDataDir({L"resources/defaultfilters.xml"}, L"share/filezilla"); + m_resourceDir = GetFZDataDir({L"resources/defaultfilters.xml"}, L"filezilla"); wxImage::AddHandler(new wxPNGHandler()); @@ -328,7 +328,7 @@ bool CFileZillaApp::LoadLocales() } #ifndef __WXMAC__ else { - m_localesDir = GetFZDataDir({L"de/filezilla.mo", L"de/LC_MESSAGES/filezilla.mo"}, L"share/locale", false); + m_localesDir = GetFZDataDir({L"de/filezilla.mo", L"de/LC_MESSAGES/filezilla.mo"}, L"locale", false); } #endif if (!m_localesDir.empty()) { diff --git a/src/interface/locale_initializer.cpp b/src/interface/locale_initializer.cpp index ea4859e..148980c 100644 --- a/src/interface/locale_initializer.cpp +++ b/src/interface/locale_initializer.cpp @@ -205,7 +205,7 @@ std::string CInitializer::GetDefaultsXmlFile() std::string selfPath = fz::to_string(GetOwnExecutableDir()); file = CheckPathForDefaults(selfPath, 0, "fzdefaults.xml"); if (selfPath.size() > 5 && fz::ends_with(selfPath, std::string("/bin/"))) { - file = CheckPathForDefaults(selfPath.substr(0, selfPath.size() - 4), 0, "share/filezilla/fzdefaults.xml"); + file = CheckPathForDefaults(selfPath.substr(0, selfPath.size() - 4), 0, "data/filezilla/fzdefaults.xml"); if (!file.empty()) { return file; } @@ -226,7 +226,7 @@ std::string CInitializer::GetDefaultsXmlFile() path += '/'; } if (segment.size() > 5 && fz::ends_with(segment, std::string("/bin/"))) { - file = CheckPathForDefaults(segment.substr(0, segment.size() - 4), 0, "share/filezilla/fzdefaults.xml"); + file = CheckPathForDefaults(segment.substr(0, segment.size() - 4), 0, "data/filezilla/fzdefaults.xml"); if (!file.empty()) { return file; } -- 2.51.0 From 1d309590068e977cad900fa4a699f3312e09aa62 Mon Sep 17 00:00:00 2001 From: David Karoly Date: Sat, 3 Dec 2022 16:39:13 +0100 Subject: Haiku: use BNotification diff --git a/src/interface/QueueView.cpp b/src/interface/QueueView.cpp index 31de7aa..13de49a 100644 --- a/src/interface/QueueView.cpp +++ b/src/interface/QueueView.cpp @@ -29,7 +29,9 @@ #include -#if WITH_LIBDBUS +#if defined(__HAIKU__) +#include +#elif WITH_LIBDBUS #include "../dbus/desktop_notification.h" #elif defined(__WXGTK__) || defined(__WXMSW__) #include @@ -2706,7 +2708,13 @@ void CQueueView::ActionAfter(bool warned) msg = _("All files have been successfully transferred"); } -#if WITH_LIBDBUS +#if defined(__HAIKU__) + BNotification notification((failed_count > 0) ? B_ERROR_NOTIFICATION : B_INFORMATION_NOTIFICATION); + notification.SetGroup("FileZilla"); + notification.SetTitle(BString(title)); + notification.SetContent(BString(msg)); + notification.Send(); +#elif WITH_LIBDBUS if (!m_desktop_notification) { m_desktop_notification = std::make_unique(); } diff --git a/src/interface/QueueView.h b/src/interface/QueueView.h index d512bba..812cf91 100644 --- a/src/interface/QueueView.h +++ b/src/interface/QueueView.h @@ -86,7 +86,9 @@ class CMainFrame; class CStatusLineCtrl; class CAsyncRequestQueue; class CQueue; -#if WITH_LIBDBUS +#if defined(__HAIKU__) +// empty +#elif WITH_LIBDBUS class CDesktopNotification; #elif defined(__WXGTK__) || defined(__WXMSW__) class wxNotificationMessage; @@ -271,7 +273,9 @@ protected: void ReleaseExclusiveEngineLock(CFileZillaEngine* pEngine); -#if WITH_LIBDBUS +#if defined(__HAIKU__) + // empty +#elif WITH_LIBDBUS std::unique_ptr m_desktop_notification; #elif defined(__WXGTK__) || defined(__WXMSW__) std::unique_ptr m_desktop_notification; -- 2.51.0 From b8df52510cebbc52b48dac135957e2929709961e Mon Sep 17 00:00:00 2001 From: David Karoly 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 148980c..ae1bac1 100644 --- a/src/interface/locale_initializer.cpp +++ b/src/interface/locale_initializer.cpp @@ -10,6 +10,12 @@ #include #include +#ifdef __HAIKU__ +#include +#include +#include +#endif + std::wstring GetOwnExecutableDir(); struct t_fallbacks @@ -77,6 +83,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(); @@ -94,6 +124,10 @@ int main(int argc, char** argv) } } +#ifdef __HAIKU__ + initialize_xdg_paths(); +#endif + return wxEntry(argc, argv); } -- 2.51.0