Skip to content

Commit 262fe0a

Browse files
vijaydasmpPastaPastaPasta
authored andcommitted
(followup) bitcoin#21244: Move GetBackupsDir to ArgsManager
1 parent 1f4e26b commit 262fe0a

File tree

4 files changed

+13
-7
lines changed

4 files changed

+13
-7
lines changed

src/qt/guiutil.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,7 @@ void openConfigfile()
643643

644644
void showBackups()
645645
{
646-
fs::path backupsDir = GetBackupsDir();
646+
fs::path backupsDir = gArgs.GetBackupsDirPath();
647647

648648
/* Open folder with default browser */
649649
if (fs::exists(backupsDir))

src/util/system.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,14 @@ const fs::path& ArgsManager::GetDataDirPath(bool net_specific) const
455455
return path;
456456
}
457457

458+
fs::path ArgsManager::GetBackupsDirPath()
459+
{
460+
if (!IsArgSet("-walletbackupsdir"))
461+
return GetDataDirPath() / "backups";
462+
463+
return fs::absolute(GetArg("-walletbackupsdir", ""));
464+
}
465+
458466
void ArgsManager::ClearPathCache()
459467
{
460468
LOCK(cs_args);
@@ -804,10 +812,7 @@ const fs::path &GetDataDir(bool fNetSpecific)
804812

805813
fs::path GetBackupsDir()
806814
{
807-
if (!gArgs.IsArgSet("-walletbackupsdir"))
808-
return GetDataDir() / "backups";
809-
810-
return fs::absolute(gArgs.GetArg("-walletbackupsdir", ""));
815+
return gArgs.GetBackupsDirPath();
811816
}
812817

813818
bool CheckDataDirOption()

src/util/system.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ void ReleaseDirectoryLocks();
9898
bool TryCreateDirectories(const fs::path& p);
9999
fs::path GetDefaultDataDir();
100100
const fs::path &GetDataDir(bool fNetSpecific = true);
101-
fs::path GetBackupsDir();
102101
// Return true if -datadir option points to a valid directory or is not specified.
103102
bool CheckDataDirOption();
104103
fs::path GetConfigFile(const std::string& confPath);
@@ -279,6 +278,8 @@ class ArgsManager
279278
*/
280279
const fs::path& GetDataDirPath(bool net_specific = true) const;
281280

281+
fs::path GetBackupsDirPath();
282+
282283
/**
283284
* Clear cached directory paths
284285
*/

src/wallet/wallet.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5017,7 +5017,7 @@ bool CWallet::AutoBackupWallet(const fs::path& wallet_path, bilingual_str& error
50175017
return false;
50185018
}
50195019

5020-
fs::path backupsDir = GetBackupsDir();
5020+
fs::path backupsDir = gArgs.GetBackupsDirPath();
50215021
backupsDir.make_preferred();
50225022

50235023
if (!fs::exists(backupsDir))

0 commit comments

Comments
 (0)