Telegram: fix working directory

This commit is contained in:
Gerasim Troeglazov
2017-09-17 00:02:35 +10:00
parent 5869434622
commit 989d59c922
2 changed files with 66 additions and 9 deletions

View File

@@ -1,4 +1,4 @@
From 86b66e1b077935140e12931ede65e3d2fb7766a2 Mon Sep 17 00:00:00 2001
From 6633953aa4444f43780107edcb5923690d781fdf Mon Sep 17 00:00:00 2001
From: Sergei Reznikov <diver@gelios.net>
Date: Sat, 9 Sep 2017 02:14:52 +0300
Subject: Haiku fixes
@@ -946,7 +946,7 @@ index 209c737..07d7438 100644
2.13.1
From ff29b8cb5dbb74b71b38aecdcc6c34ef332bc992 Mon Sep 17 00:00:00 2001
From ef4d838bf16701d96fe657ac422d1b5698019504 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Fri, 15 Sep 2017 22:01:57 +1000
Subject: Fix typo
@@ -969,7 +969,7 @@ index 0d09e7d..793310e 100644
2.13.1
From f9cc091937e47b23b8bd00febbaf77859c693e3e Mon Sep 17 00:00:00 2001
From 6fca2e8b3c67a4479cfa71bf735a1ba91835013b Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Fri, 15 Sep 2017 22:05:59 +1000
Subject: Add haiku platform modules
@@ -2312,7 +2312,7 @@ index e303272..1bd4c74 100644
2.13.1
From 05a6ba8f96de3ec4a92e0dca8e84484363163b7f Mon Sep 17 00:00:00 2001
From c183162abdec7dd3ddea85c7e637912076ab35f6 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Fri, 15 Sep 2017 22:09:06 +1000
Subject: Add haiku platform for settings
@@ -2346,7 +2346,7 @@ index 4306551..df713a3 100644
2.13.1
From de5a4231be3eefb0fa8fb1928bfa2d6256ff23e0 Mon Sep 17 00:00:00 2001
From df87885512c1377a2a056053f661f5e74397c5af Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Fri, 15 Sep 2017 22:09:59 +1000
Subject: Fix Qt plugins path
@@ -2371,7 +2371,7 @@ index 4684e2a..c65879b 100644
2.13.1
From 3fcdcb3cade74b2d1e01c3128f3f4b93d7392460 Mon Sep 17 00:00:00 2001
From 26f0a37bf988909edffff348f51e0a1b535bc4ac Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Fri, 15 Sep 2017 22:10:59 +1000
Subject: Fix crash
@@ -2402,7 +2402,7 @@ index b0a1ade..9c84a34 100644
2.13.1
From 91265e4625edf5ce0290d4b8eb75c5ec025943d3 Mon Sep 17 00:00:00 2001
From ce1e1cfc24fac52864e13a95a974b3e588f0c204 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Fri, 15 Sep 2017 22:14:32 +1000
Subject: Add haiku platform files to build
@@ -2477,3 +2477,60 @@ index 58f2789..f86e6e6 100644
--
2.13.1
From 28ec800e587b2a67e9797044cbcffb949329b59c Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Sat, 16 Sep 2017 23:06:27 +1000
Subject: Move working dir to user settings
diff --git a/Telegram/SourceFiles/logs.cpp b/Telegram/SourceFiles/logs.cpp
index d916756..3d61a91 100644
--- a/Telegram/SourceFiles/logs.cpp
+++ b/Telegram/SourceFiles/logs.cpp
@@ -311,7 +311,7 @@ namespace Logs {
QString initialWorkingDir = QDir(cWorkingDir()).absolutePath() + '/', moveOldDataFrom;
if (cBetaVersion()) {
cSetDebug(true);
-#if defined Q_OS_MAC || defined Q_OS_LINUX
+#if defined Q_OS_MAC || defined Q_OS_LINUX || defined Q_OS_HAIKU
} else {
#ifdef _DEBUG
cForceWorkingDir(cExeDir());
diff --git a/Telegram/SourceFiles/platform/haiku/specific_haiku.cpp b/Telegram/SourceFiles/platform/haiku/specific_haiku.cpp
index ce9091a..004017b 100644
--- a/Telegram/SourceFiles/platform/haiku/specific_haiku.cpp
+++ b/Telegram/SourceFiles/platform/haiku/specific_haiku.cpp
@@ -285,28 +285,9 @@ void psActivateProcess(uint64 pid) {
// objc_activateProgram();
}
-namespace {
-
-QString getHomeDir() {
- struct passwd *pw = getpwuid(getuid());
- return (pw && pw->pw_dir && strlen(pw->pw_dir)) ? (QFile::decodeName(pw->pw_dir) + '/') : QString();
-}
-
-} // namespace
QString psAppDataPath() {
- // Previously we used ~/.TelegramDesktop, so look there first.
- // If we find data there, we should still use it.
- auto home = getHomeDir();
- if (!home.isEmpty()) {
- auto oldPath = home + qsl(".TelegramDesktop/");
- auto oldSettingsBase = oldPath + qsl("tdata/settings");
- if (QFile(oldSettingsBase + '0').exists() || QFile(oldSettingsBase + '1').exists()) {
- return oldPath;
- }
- }
-
- return QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + '/';
+ return QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + '/';
}
QString psDownloadPath() {
--
2.13.1

View File

@@ -3,7 +3,7 @@ DESCRIPTION="Official desktop version of Telegram messaging app."
HOMEPAGE="https://www.telegram.org/"
COPYRIGHT="2013-2017 Telegram"
LICENSE="GNU GPL v3"
REVISION="2"
REVISION="3"
SOURCE_URI="https://github.com/telegramdesktop/tdesktop/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="56b7fce84adf85a4af1c3174353169f32d0b0c052a4e7a284fc741fa96b04030"
COMMIT_2="757a5d8ec31aadcf387ac3cb135256152c18de1c"
@@ -81,7 +81,7 @@ BUILD_PREREQUIRES="
BUILD()
{
# link submodules
rm -rf Telegram/ThirdParty/{libtgvoip, variant, GSL, Catch}
rm -rf Telegram/ThirdParty/{libtgvoip,variant,GSL,Catch}
ln -sfn $sourceDir2/libtgvoip-$COMMIT_2 Telegram/ThirdParty/libtgvoip
ln -sfn $sourceDir3/variant-$COMMIT_3 Telegram/ThirdParty/variant
ln -sfn $sourceDir4/GSL-$COMMIT_4 Telegram/ThirdParty/GSL