From 897fbff8679f4e27b00ccdfd8c27465d5cc5bd90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Sat, 26 Jul 2014 20:07:12 +0200 Subject: [PATCH] beshare: Fix paths for writable folders (logs, downloads, shared) --- haiku-apps/beshare/beshare-4.recipe | 3 +- haiku-apps/beshare/patches/beshare-4.patchset | 74 +++++++++++++++++++ 2 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 haiku-apps/beshare/patches/beshare-4.patchset diff --git a/haiku-apps/beshare/beshare-4.recipe b/haiku-apps/beshare/beshare-4.recipe index da4f1d980..99877ee66 100644 --- a/haiku-apps/beshare/beshare-4.recipe +++ b/haiku-apps/beshare/beshare-4.recipe @@ -61,8 +61,9 @@ BUILD_PREREQUIRES=" makefile_engine " +PATCHES="beshare-4.patchset" PATCHES_2="muscle-6.05.patchset" - + BUILD() { ln -s ../../sources-2/muscle muscle diff --git a/haiku-apps/beshare/patches/beshare-4.patchset b/haiku-apps/beshare/patches/beshare-4.patchset new file mode 100644 index 000000000..bc340b544 --- /dev/null +++ b/haiku-apps/beshare/patches/beshare-4.patchset @@ -0,0 +1,74 @@ +From 1cbd0da01555e012f24662c986f918e4a910b708 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= +Date: Sat, 26 Jul 2014 19:45:13 +0200 +Subject: [PATCH] Fix paths for writable directories (logs, downloads, shared) + +BeShare had the bad habit of putting everything inside +it's own folder... + +Now we should have: +~/config/var/log/BeShare/ +~/BeShare downloads/ +~/BeShare shared/ +--- + source/ChatWindow.cpp | 31 +++++++++++++++++++++---------- + 1 file changed, 21 insertions(+), 10 deletions(-) + +diff --git a/source/ChatWindow.cpp b/source/ChatWindow.cpp +index 54a4e33..0722bb7 100644 +--- a/source/ChatWindow.cpp ++++ b/source/ChatWindow.cpp +@@ -7,6 +7,7 @@ + #include + + #include ++#include + #include + #include + #include +@@ -1170,22 +1171,32 @@ ChatWindow::AddBorderView(BView * v) + status_t + ChatWindow::GetAppSubdir(const char * subDirName, BDirectory & subDir, bool createIfNecessary) const + { +- app_info appInfo; +- be_app->GetAppInfo(&appInfo); +- BEntry appEntry(&appInfo.ref); +- appEntry.GetParent(&appEntry); // get the directory it's in +- BPath path(&appEntry); +- BPath subPath(&appEntry); +- subPath.Append(subDirName); ++ directory_which which = B_USER_DIRECTORY; ++ if (!strcmp(subDirName, "logs")) ++ which = B_USER_LOG_DIRECTORY; ++ BPath path; ++ status_t err; ++ ++ err = find_directory(which, &path, true); ++ if (err != B_OK) ++ return err; ++ ++ BDirectory baseDir(path.Path()); ++ err = baseDir.InitCheck(); ++ if (err != B_OK) ++ return err; ++ ++ BString leaf("BeShare"); ++ if (strcmp(subDirName, "logs")) ++ leaf << " " << subDirName; + + // If the directory is already there, use it +- if (subDir.SetTo(subPath.Path()) == B_NO_ERROR) return B_NO_ERROR; ++ if (subDir.SetTo(&baseDir, leaf.String()) == B_NO_ERROR) return B_NO_ERROR; + + // Directory not there? Shall we create it then? + if (createIfNecessary) + { +- BDirectory appDir(path.Path()); +- if ((appDir.InitCheck() == B_NO_ERROR)&&(appDir.CreateDirectory(subDirName, &subDir) == B_NO_ERROR)) return B_NO_ERROR; ++ if (baseDir.CreateDirectory(leaf.String(), &subDir) == B_NO_ERROR) return B_NO_ERROR; + } + return B_ERROR; // oops, couldn't get it + } +-- +1.8.3.4 +