File tree Expand file tree Collapse file tree 2 files changed +21
-5
lines changed Expand file tree Collapse file tree 2 files changed +21
-5
lines changed Original file line number Diff line number Diff line change @@ -404,7 +404,7 @@ const fs::path& ArgsManager::GetBlocksDirPath() const
404
404
return path;
405
405
}
406
406
} else {
407
- path = GetDataDirPath ( false );
407
+ path = GetDataDirBase ( );
408
408
}
409
409
410
410
path /= BaseParams ().DataDir ();
@@ -513,7 +513,7 @@ bool ArgsManager::GetSettingsPath(fs::path* filepath, bool temp) const
513
513
}
514
514
if (filepath) {
515
515
std::string settings = GetArg (" -settings" , BITCOIN_SETTINGS_FILENAME);
516
- *filepath = fsbridge::AbsPathJoin (GetDataDirPath ( /* net_specific= */ true ), temp ? settings + " .tmp" : settings);
516
+ *filepath = fsbridge::AbsPathJoin (GetDataDirNet ( ), temp ? settings + " .tmp" : settings);
517
517
}
518
518
return true ;
519
519
}
@@ -804,7 +804,7 @@ fs::path GetDefaultDataDir()
804
804
805
805
const fs::path &GetDataDir (bool fNetSpecific )
806
806
{
807
- return gArgs .GetDataDirPath ( fNetSpecific );
807
+ return fNetSpecific ? gArgs .GetDataDirNet () : gArgs . GetDataDirBase ( );
808
808
}
809
809
810
810
bool CheckDataDirOption ()
@@ -1361,7 +1361,7 @@ fs::path AbsPathForConfigVal(const fs::path& path, bool net_specific)
1361
1361
if (path.is_absolute ()) {
1362
1362
return path;
1363
1363
}
1364
- return fsbridge::AbsPathJoin (GetDataDir ( net_specific), path);
1364
+ return fsbridge::AbsPathJoin (net_specific ? gArgs . GetDataDirNet () : gArgs . GetDataDirBase ( ), path);
1365
1365
}
1366
1366
1367
1367
void ScheduleBatchPriority ()
Original file line number Diff line number Diff line change @@ -119,7 +119,7 @@ UniValue RunCommandParseJSON(const std::string& str_command, const std::string&
119
119
* the datadir if they are not absolute.
120
120
*
121
121
* @param path The path to be conditionally prefixed with datadir.
122
- * @param net_specific Forwarded to GetDataDir().
122
+ * @param net_specific Use network specific datadir variant
123
123
* @return The normalized path.
124
124
*/
125
125
fs::path AbsPathForConfigVal (const fs::path& path, bool net_specific = true );
@@ -268,6 +268,22 @@ class ArgsManager
268
268
*/
269
269
const fs::path& GetBlocksDirPath () const ;
270
270
271
+ /* *
272
+ * Get data directory path
273
+ *
274
+ * @return Absolute path on success, otherwise an empty path when a non-directory path would be returned
275
+ * @post Returned directory path is created unless it is empty
276
+ */
277
+ const fs::path& GetDataDirBase () const { return GetDataDirPath (false ); }
278
+
279
+ /* *
280
+ * Get data directory path with appended network identifier
281
+ *
282
+ * @return Absolute path on success, otherwise an empty path when a non-directory path would be returned
283
+ * @post Returned directory path is created unless it is empty
284
+ */
285
+ const fs::path& GetDataDirNet () const { return GetDataDirPath (true ); }
286
+
271
287
/* *
272
288
* Get data directory path
273
289
*
You can’t perform that action at this time.
0 commit comments