-
Notifications
You must be signed in to change notification settings - Fork 35.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
system: use %LOCALAPPDATA% as default datadir on windows #27064
Conversation
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code CoverageFor detailed information about the code coverage, see the test coverage report. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. ConflictsNo conflicts as of last run. |
cc @sipsorcery |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK a2bfd52
Note that in Windows 11 this change may be moot
Win 11 isn't used a lot though.
Usage: https://gs.statcounter.com/os-version-market-share/windows/desktop/worldwide
Failure discussion: https://techcommunity.microsoft.com/t5/windows-11/why-users-are-not-upgrading-to-windows-11-is-windows-11-a/m-p/3611663
Would this change need a |
a2bfd52
to
d0b715a
Compare
Push to 60cd07b:
|
Concept ACK. |
src/common/args.cpp
Outdated
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 / "chainstate")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update the PR description:
we check for the existence of
C:\Users\Username\AppData\Roaming\Bitcoin\blocks
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch thanks. (fixed) First draft of this PR did check for blocks
directory but of course that is unreliable because it could be customized by the user.
This change ignores non-main network data. I'm OK with that. But it seems worth mentioning in the docs. |
Ah I see, because I'm checking for
Sure but I feel like that's not super clean either. |
Why would we prefer local over roaming explicitly? |
From https://www.makeuseof.com/tag/appdata-roaming-vs-local/
In other words, 500 GB of blockchain data would be copied to a user's remote workstation as they move around. Roaming is just supposed to be for small files like profile preferences, etc. Not big data stores. More discussion in #2391 |
I think we should check for existence of |
60cd07b
to
c941712
Compare
revised, rebased on master and pushed thanks. I tested this "in production" on my windows laptop but found writing a functional test to be impossible. I thought I could model a test after @ryanofsky commit here: 8d777c0 ...but for default datadir we use windows' |
Could rebase for fresh CI, if still relevant? |
crACK c941712 Have not yet tested on a Windows machine. |
c941712
to
c59b1e4
Compare
rebased on master |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK c59b1e4, tested on Windows 11 Pro 23H2.
doc/bitcoin-conf.md
Outdated
@@ -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 | `%APPDATA%\Bitcoin\` | `C:\Users\username\AppData\Local\Bitcoin\bitcoin.conf` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Windows | `%APPDATA%\Bitcoin\` | `C:\Users\username\AppData\Local\Bitcoin\bitcoin.conf` | |
Windows | `%LOCALAPPDATA%\Bitcoin\` | `C:\Users\username\AppData\Local\Bitcoin\bitcoin.conf` |
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 | ||
compatability if it is present. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo:
compatability if it is present. | |
compatibility if it is present. |
src/common/args.cpp
Outdated
if (fs::exists(legacy_path)) | ||
return legacy_path; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Could add curly braces or put in a single line?
c59b1e4
to
84900ac
Compare
@hebasto thanks for the review, I addressed your comments |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 84900ac Tested on Windows. |
crACK 84900ac Have not tested on a Windows machine. |
Closes #2391
This PR changes the default datadir location on Windows from
C:\Users\Username\AppData\Roaming\Bitcoin
toC:\Users\Username\AppData\Local\Bitcoin
. This change only applies to fresh installs. To preserve backwards compatibility, on startup we check for the existence ofC:\Users\Username\AppData\Roaming\Bitcoin\chainstate
and if it is there, we continue using the "Roaming" directory as the default datadir location.Note that in Windows 11 this change may be moot: