mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-01 09:35:52 -05:00
system: use %LOCALAPPDATA% as default datadir on windows
This commit is contained in:
parent
312f54278f
commit
855dd8d592
4 changed files with 12 additions and 5 deletions
|
@ -59,7 +59,7 @@ The `includeconf=<file>` option in the `bitcoin.conf` file can be used to includ
|
|||
|
||||
Operating System | Data Directory | Example Path
|
||||
-- | -- | --
|
||||
Windows | `%APPDATA%\Bitcoin\` | `C:\Users\username\AppData\Roaming\Bitcoin\bitcoin.conf`
|
||||
Windows | `%LOCALAPPDATA%\Bitcoin\` | `C:\Users\username\AppData\Local\Bitcoin\bitcoin.conf`
|
||||
Linux | `$HOME/.bitcoin/` | `/home/username/.bitcoin/bitcoin.conf`
|
||||
macOS | `$HOME/Library/Application Support/Bitcoin/` | `/Users/username/Library/Application Support/Bitcoin/bitcoin.conf`
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ Platform | Data directory path
|
|||
---------|--------------------
|
||||
Linux | `$HOME/.bitcoin/`
|
||||
macOS | `$HOME/Library/Application Support/Bitcoin/`
|
||||
Windows | `%APPDATA%\Bitcoin\` <sup>[\[1\]](#note1)</sup>
|
||||
Windows | `%LOCALAPPDATA%\Bitcoin\` <sup>[\[1\]](#note1)</sup>
|
||||
|
||||
2. A custom data directory path can be specified with the `-datadir` option.
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ By default, wallets are created in the `wallets` folder of the data directory, w
|
|||
| Operating System | Default wallet directory |
|
||||
| -----------------|:------------------------------------------------------------|
|
||||
| Linux | `/home/<user>/.bitcoin/wallets` |
|
||||
| Windows | `C:\Users\<user>\AppData\Roaming\Bitcoin\wallets` |
|
||||
| Windows | `C:\Users\<user>\AppData\Local\Bitcoin\wallets` |
|
||||
| macOS | `/Users/<user>/Library/Application Support/Bitcoin/wallets` |
|
||||
|
||||
### 1.2 Encrypting the Wallet
|
||||
|
|
|
@ -696,12 +696,19 @@ bool HasTestOption(const ArgsManager& args, const std::string& test_option)
|
|||
|
||||
fs::path GetDefaultDataDir()
|
||||
{
|
||||
// Windows: C:\Users\Username\AppData\Roaming\Bitcoin
|
||||
// Windows:
|
||||
// old: C:\Users\Username\AppData\Roaming\Bitcoin
|
||||
// new: C:\Users\Username\AppData\Local\Bitcoin
|
||||
// macOS: ~/Library/Application Support/Bitcoin
|
||||
// Unix-like: ~/.bitcoin
|
||||
#ifdef WIN32
|
||||
// Windows
|
||||
return GetSpecialFolderPath(CSIDL_APPDATA) / "Bitcoin";
|
||||
// Check for existence of datadir in old location and keep it there
|
||||
fs::path legacy_path = GetSpecialFolderPath(CSIDL_APPDATA) / "Bitcoin";
|
||||
if (fs::exists(legacy_path)) return legacy_path;
|
||||
|
||||
// Otherwise, fresh installs can start in the new, "proper" location
|
||||
return GetSpecialFolderPath(CSIDL_LOCAL_APPDATA) / "Bitcoin";
|
||||
#else
|
||||
fs::path pathRet;
|
||||
char* pszHome = getenv("HOME");
|
||||
|
|
Loading…
Add table
Reference in a new issue