mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-05 09:33:25 -08:00
[Client] Warn when data paths point inside the program directory (#7473)
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
parent
f83a61979f
commit
57a6a0d9cb
10 changed files with 247 additions and 1 deletions
|
|
@ -1,6 +1,7 @@
|
|||
#include "general_settings_page.h"
|
||||
|
||||
#include "../../../client/settings/cache_settings.h"
|
||||
#include "../dialogs/path_safety_warning.h"
|
||||
#include "../interface/card_picture_loader/card_picture_loader.h"
|
||||
#include "../main.h"
|
||||
#include "../server/user/user_info_connection.h"
|
||||
|
|
@ -378,6 +379,9 @@ void GeneralSettingsPage::deckPathButtonClicked()
|
|||
if (path.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
if (!PathSafetyWarning::confirmOutsideProgramDir(this, path)) {
|
||||
return;
|
||||
}
|
||||
|
||||
deckPathEdit->setText(path);
|
||||
SettingsCache::instance().paths().setDeckPath(path);
|
||||
|
|
@ -389,6 +393,9 @@ void GeneralSettingsPage::filtersPathButtonClicked()
|
|||
if (path.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
if (!PathSafetyWarning::confirmOutsideProgramDir(this, path)) {
|
||||
return;
|
||||
}
|
||||
|
||||
filtersPathEdit->setText(path);
|
||||
SettingsCache::instance().paths().setFiltersPath(path);
|
||||
|
|
@ -400,6 +407,9 @@ void GeneralSettingsPage::replaysPathButtonClicked()
|
|||
if (path.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
if (!PathSafetyWarning::confirmOutsideProgramDir(this, path)) {
|
||||
return;
|
||||
}
|
||||
|
||||
replaysPathEdit->setText(path);
|
||||
SettingsCache::instance().paths().setReplaysPath(path);
|
||||
|
|
@ -411,6 +421,9 @@ void GeneralSettingsPage::picsPathButtonClicked()
|
|||
if (path.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
if (!PathSafetyWarning::confirmOutsideProgramDir(this, path)) {
|
||||
return;
|
||||
}
|
||||
|
||||
picsPathEdit->setText(path);
|
||||
SettingsCache::instance().paths().setPicsPath(path);
|
||||
|
|
@ -422,6 +435,9 @@ void GeneralSettingsPage::cardDatabasePathButtonClicked()
|
|||
if (path.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
if (!PathSafetyWarning::confirmOutsideProgramDir(this, path)) {
|
||||
return;
|
||||
}
|
||||
|
||||
cardDatabasePathEdit->setText(path);
|
||||
SettingsCache::instance().paths().setCardDatabasePath(path);
|
||||
|
|
@ -433,6 +449,9 @@ void GeneralSettingsPage::customCardDatabaseButtonClicked()
|
|||
if (path.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
if (!PathSafetyWarning::confirmOutsideProgramDir(this, path)) {
|
||||
return;
|
||||
}
|
||||
|
||||
customCardDatabasePathEdit->setText(path);
|
||||
SettingsCache::instance().paths().setCustomCardDatabasePath(path);
|
||||
|
|
@ -444,6 +463,9 @@ void GeneralSettingsPage::tokenDatabasePathButtonClicked()
|
|||
if (path.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
if (!PathSafetyWarning::confirmOutsideProgramDir(this, path)) {
|
||||
return;
|
||||
}
|
||||
|
||||
tokenDatabasePathEdit->setText(path);
|
||||
SettingsCache::instance().paths().setTokenDatabasePath(path);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue