fix(paths): cross-platform path resolution & env var support - #5
Open
Anstarc wants to merge 1 commit into
Open
Conversation
Previously Trae data/install dirs were hardcoded to Windows paths (~/AppData/Roaming/Trae CN, ~/AppData/Local/Programs/Trae-CN), which broke on macOS/Linux and non-default installs. The env override in scripts/fetch-models-vscdb.js was also ineffective because .env was never loaded when run standalone. - Add src/paths.js: centralized resolver with per-OS base dirs (Windows %APPDATA%/%LOCALAPPDATA%, macOS ~/Library/Application Support and /Applications, Linux $XDG_CONFIG_HOME and /opt) and env overrides: TRAE_EDITION, TRAE_*_DATA_DIR, TRAE_DATA_DIR, TRAE_*_FOLDER, TRAE_*_INSTALL_FOLDER. - Refactor auth.js, trae-decrypt.js, scripts/fetch-models-vscdb.js to consume paths.js, removing all hardcoded Windows-only paths and the cnPath/sgPath copy-paste dead code in trae-decrypt.js. - Load .env via dotenv in fetch-models-vscdb.js so TRAE_*_DATA_DIR (and other vars) are honored when the script runs standalone. - Document all new env vars in .env.example. Non-default Trae installations and non-Windows platforms now work without code changes.
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.
Previously Trae data/install dirs were hardcoded to Windows paths (~/AppData/Roaming/Trae CN, ~/AppData/Local/Programs/Trae-CN), which broke on macOS/Linux and non-default installs. The env override in scripts/fetch-models-vscdb.js was also ineffective because .env was never loaded when run standalone.