mirror of
https://github.com/vale981/tdesktop
synced 2025-03-06 02:01:40 -05:00
Use separate download folder for support.
This commit is contained in:
parent
7705999e57
commit
3f58c930e3
13 changed files with 17 additions and 29 deletions
|
@ -138,6 +138,16 @@ void ShowInFolder(const QString &filepath) {
|
|||
});
|
||||
}
|
||||
|
||||
QString DefaultDownloadPath() {
|
||||
return QStandardPaths::writableLocation(
|
||||
QStandardPaths::DownloadLocation)
|
||||
+ '/'
|
||||
+ (AuthSession::Exists() && Auth().supportMode()
|
||||
? "Tsupport Desktop"
|
||||
: str_const_toString(AppName))
|
||||
+ '/';
|
||||
}
|
||||
|
||||
namespace internal {
|
||||
|
||||
void UnsafeOpenEmailLinkDefault(const QString &email) {
|
||||
|
|
|
@ -35,6 +35,8 @@ void OpenWith(const QString &filepath, QPoint menuPosition);
|
|||
void Launch(const QString &filepath);
|
||||
void ShowInFolder(const QString &filepath);
|
||||
|
||||
QString DefaultDownloadPath();
|
||||
|
||||
namespace internal {
|
||||
|
||||
inline QString UrlToLocalDefault(const QUrl &url) {
|
||||
|
|
|
@ -146,7 +146,7 @@ QString FileNameUnsafe(
|
|||
|
||||
QString path;
|
||||
if (Global::DownloadPath().isEmpty()) {
|
||||
path = psDownloadPath();
|
||||
path = File::DefaultDownloadPath();
|
||||
} else if (Global::DownloadPath() == qsl("tmp")) {
|
||||
path = cTempDir();
|
||||
} else {
|
||||
|
|
|
@ -109,12 +109,12 @@ bool IsDefaultPath(const QString &path) {
|
|||
: value;
|
||||
return (cPlatform() == dbipWindows) ? result.toLower() : result;
|
||||
};
|
||||
return (check(path) == check(psDownloadPath()));
|
||||
return (check(path) == check(File::DefaultDownloadPath()));
|
||||
}
|
||||
|
||||
void ResolveSettings(Settings &settings) {
|
||||
if (settings.path.isEmpty()) {
|
||||
settings.path = psDownloadPath();
|
||||
settings.path = File::DefaultDownloadPath();
|
||||
settings.forceSubPath = true;
|
||||
} else {
|
||||
settings.forceSubPath = IsDefaultPath(settings.path);
|
||||
|
@ -381,7 +381,7 @@ void PanelController::saveSettings() const {
|
|||
return (cPlatform() == dbipWindows) ? result.toLower() : result;
|
||||
};
|
||||
auto settings = *_settings;
|
||||
if (check(settings.path) == check(psDownloadPath())) {
|
||||
if (check(settings.path) == check(File::DefaultDownloadPath())) {
|
||||
settings.path = QString();
|
||||
}
|
||||
Local::WriteExportSettings(settings);
|
||||
|
|
|
@ -979,7 +979,7 @@ void MediaView::onDownload() {
|
|||
|
||||
QString path;
|
||||
if (Global::DownloadPath().isEmpty()) {
|
||||
path = psDownloadPath();
|
||||
path = File::DefaultDownloadPath();
|
||||
} else if (Global::DownloadPath() == qsl("tmp")) {
|
||||
path = cTempDir();
|
||||
} else {
|
||||
|
|
|
@ -306,10 +306,6 @@ QString psAppDataPath() {
|
|||
return QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + '/';
|
||||
}
|
||||
|
||||
QString psDownloadPath() {
|
||||
return QStandardPaths::writableLocation(QStandardPaths::DownloadLocation) + '/' + str_const_toString(AppName) + '/';
|
||||
}
|
||||
|
||||
void psDoCleanup() {
|
||||
try {
|
||||
psAutoStart(false, true);
|
||||
|
|
|
@ -59,7 +59,6 @@ void psClearInitLogs();
|
|||
void psActivateProcess(uint64 pid = 0);
|
||||
QString psLocalServerPrefix();
|
||||
QString psAppDataPath();
|
||||
QString psDownloadPath();
|
||||
void psAutoStart(bool start, bool silent = false);
|
||||
void psSendToMenu(bool send, bool silent = false);
|
||||
|
||||
|
|
|
@ -58,7 +58,6 @@ void psClearInitLogs();
|
|||
void psActivateProcess(uint64 pid = 0);
|
||||
QString psLocalServerPrefix();
|
||||
QString psAppDataPath();
|
||||
QString psDownloadPath();
|
||||
void psAutoStart(bool start, bool silent = false);
|
||||
void psSendToMenu(bool send, bool silent = false);
|
||||
|
||||
|
|
|
@ -206,10 +206,6 @@ QString psAppDataPath() {
|
|||
return objc_appDataPath();
|
||||
}
|
||||
|
||||
QString psDownloadPath() {
|
||||
return objc_downloadPath();
|
||||
}
|
||||
|
||||
void psDoCleanup() {
|
||||
try {
|
||||
psAutoStart(false, true);
|
||||
|
|
|
@ -31,7 +31,6 @@ double objc_appkitVersion();
|
|||
|
||||
QString objc_documentsPath();
|
||||
QString objc_appDataPath();
|
||||
QString objc_downloadPath();
|
||||
QByteArray objc_downloadPathBookmark(const QString &path);
|
||||
QByteArray objc_pathBookmark(const QString &path);
|
||||
void objc_downloadPathEnableAccess(const QByteArray &bookmark);
|
||||
|
|
|
@ -489,14 +489,6 @@ QString objc_appDataPath() {
|
|||
return QString();
|
||||
}
|
||||
|
||||
QString objc_downloadPath() {
|
||||
NSURL *url = [[NSFileManager defaultManager] URLForDirectory:NSDownloadsDirectory inDomain:NSUserDomainMask appropriateForURL:nil create:YES error:nil];
|
||||
if (url) {
|
||||
return QString::fromUtf8([[url path] fileSystemRepresentation]) + '/' + str_const_toString(AppName) + '/';
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
||||
QByteArray objc_downloadPathBookmark(const QString &path) {
|
||||
#ifndef OS_MAC_STORE
|
||||
return QByteArray();
|
||||
|
|
|
@ -193,10 +193,6 @@ QString psAppDataPathOld() {
|
|||
return QString();
|
||||
}
|
||||
|
||||
QString psDownloadPath() {
|
||||
return QStandardPaths::writableLocation(QStandardPaths::DownloadLocation) + '/' + str_const_toString(AppName) + '/';
|
||||
}
|
||||
|
||||
void psDoCleanup() {
|
||||
try {
|
||||
psAutoStart(false, true);
|
||||
|
|
|
@ -68,7 +68,6 @@ void psActivateProcess(uint64 pid = 0);
|
|||
QString psLocalServerPrefix();
|
||||
QString psAppDataPath();
|
||||
QString psAppDataPathOld();
|
||||
QString psDownloadPath();
|
||||
void psAutoStart(bool start, bool silent = false);
|
||||
void psSendToMenu(bool send, bool silent = false);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue