fix: use platform-aware data directory instead of Windows-only LOCALAPPDATA#19
Open
DeryFerd wants to merge 1 commit into
Open
fix: use platform-aware data directory instead of Windows-only LOCALAPPDATA#19DeryFerd wants to merge 1 commit into
DeryFerd wants to merge 1 commit into
Conversation
ff0602b to
2077cf6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What's the problem?
The app hardcodes
%LOCALAPPDATA%\BoomBoomas its data directory. That's a Windows-only path — it breaks entirely on macOS and Linux becauseLOCALAPPDATAdoesn't exist there. Even the fallback (os.path.expanduser("~")) dumps the database and assets directly into the user's home directory, which is messy and not how any platform expects apps to store their data.This also means contributors on macOS or Linux literally can't run the app without manually setting
LOCALAPPDATAas an env var, which is a bad onboarding experience for an open-source project.What this PR does
Adds a _data_dir() helper that returns the correct platform-specific data directory, then replaces every hardcoded
BoomBoom/LOCALAPPDATAreference in the codebase with a call to this function.Platform paths:
%LOCALAPPDATA%/JustHireMe~/Library/Application Support/JustHireMe~/.local/share/justhireme(respects$XDG_DATA_HOME)Files changed:
sys.platform. Replaced the old_b = os.path.join(os.environ.get("LOCALAPPDATA", ...), "BoomBoom")with_b = _data_dir().LOCALAPPDATA/BoomBoom/assetsnow use _data_dir() via a local wrapper._assetspath now uses _data_dir() instead of hardcodedLOCALAPPDATA.db.client(they run before the package is set up), so they each have their own inline _data_dir() copy.JustHireMe/andjusthireme/alongside the oldBoomBoom/entry so the new data directories are also ignored.Migration notes
On Windows, the data directory changes from
%LOCALAPPDATA%/BoomBoomto%LOCALAPPDATA%/JustHireMe. Existing users will need to rename or copy theirBoomBoomfolder toJustHireMe. The oldBoomBoom/entry in .gitignore is kept so it doesn't suddenly show up as untracked.On macOS and Linux, this is the first time the app has a proper data directory, so no migration needed.