diff --git a/doc/bitcoin-conf.md b/doc/bitcoin-conf.md index 1ebfb4c1de9..76711d0e7d2 100644 --- a/doc/bitcoin-conf.md +++ b/doc/bitcoin-conf.md @@ -59,7 +59,7 @@ The `includeconf=` 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` diff --git a/doc/files.md b/doc/files.md index f88d3f91a1c..03e52f02c92 100644 --- a/doc/files.md +++ b/doc/files.md @@ -28,7 +28,7 @@ Platform | Data directory path ---------|-------------------- Linux | `$HOME/.bitcoin/` macOS | `$HOME/Library/Application Support/Bitcoin/` -Windows | `%APPDATA%\Bitcoin\` [\[1\]](#note1) +Windows | `%LOCALAPPDATA%\Bitcoin\` [\[1\]](#note1) 2. A custom data directory path can be specified with the `-datadir` option. diff --git a/doc/managing-wallets.md b/doc/managing-wallets.md index b99d88877b6..1cfd2e51231 100644 --- a/doc/managing-wallets.md +++ b/doc/managing-wallets.md @@ -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//.bitcoin/wallets` | -| Windows | `C:\Users\\AppData\Roaming\Bitcoin\wallets` | +| Windows | `C:\Users\\AppData\Local\Bitcoin\wallets` | | macOS | `/Users//Library/Application Support/Bitcoin/wallets` | ### 1.2 Encrypting the Wallet diff --git a/doc/release-notes/release-notes-27064.md b/doc/release-notes/release-notes-27064.md new file mode 100644 index 00000000000..be3ecee1b8e --- /dev/null +++ b/doc/release-notes/release-notes-27064.md @@ -0,0 +1,7 @@ +Files +----- + +The default data directory on Windows has been moved from `C:\Users\Username\AppData\Roaming\Bitcoin` +to `C:\Users\Username\AppData\Local\Bitcoin`. Bitcoin Core will check the existence +of the old directory first and continue to use that directory for backwards +compatibility if it is present. \ No newline at end of file diff --git a/src/common/args.cpp b/src/common/args.cpp index c90eb0c6856..caff36fdb30 100644 --- a/src/common/args.cpp +++ b/src/common/args.cpp @@ -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");