mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-09 05:10:05 +02:00
beshare: Fix paths for writable folders (logs, downloads, shared)
This commit is contained in:
@@ -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
|
||||
|
||||
74
haiku-apps/beshare/patches/beshare-4.patchset
Normal file
74
haiku-apps/beshare/patches/beshare-4.patchset
Normal file
@@ -0,0 +1,74 @@
|
||||
From 1cbd0da01555e012f24662c986f918e4a910b708 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= <revol@free.fr>
|
||||
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 <Beep.h>
|
||||
|
||||
#include <Application.h>
|
||||
+#include <FindDirectory.h>
|
||||
#include <Roster.h>
|
||||
#include <MessageFilter.h>
|
||||
#include <StringView.h>
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user