Skip to content

feat: platform-specific directory support - #172

Closed
binbandit wants to merge 16 commits into
openai:mainfrom
binbandit:feat/xdg-platform-dirs
Closed

binbandit wants to merge 16 commits into
openai:mainfrom
binbandit:feat/xdg-platform-dirs

Conversation

@binbandit

Copy link
Copy Markdown
Contributor

Platform-Specific Directory Support

Description

This PR implements proper platform-specific directory support following standard conventions:

Changes

  • Added new platform-dirs.ts utility module for platform-specific directory paths
  • Updated configuration system to use these directories with backward compatibility
  • Implemented automatic migration of files from legacy ~/.codex location
  • Updated all relevant modules to use the new directory structure
  • Added comprehensive tests for the new functionality
  • Updated documentation in README.md

Benefits

  • Follows platform-specific best practices for application data storage
  • Keeps user home directory clean (no more dotfiles clutter)
  • Maintains backward compatibility with existing installations
  • Provides a smooth migration path for existing users

Testing

  • Added dedicated test suite for platform-specific directory functions
  • Verified all existing tests pass with the new implementation
  • Manually tested migration functionality

Screenshots

N/A

Additional Notes

The migration process is automatic and happens on first run after updating. Users don't need to take any action to migrate their existing configuration.

…m Programming Guide compliance

Signed-off-by: crazywolf132 <[email protected]>
@github-actions

github-actions Bot commented Apr 17, 2025 •

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@binbandit

Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@binbandit

Copy link
Copy Markdown
Contributor Author

recheck

github-actions Bot added a commit that referenced this pull request Apr 17, 2025
@tibo-openai

Copy link
Copy Markdown
Collaborator

This is fantastically structured PR, thank you for putting in the effort to make the code clean and adding tests. I do see that ci fails with

Checking formatting...
[warn] src/utils/agent/sandbox/macos-seatbelt.ts
[warn] src/utils/config.ts
[warn] src/utils/platform-dirs.ts
[warn] tests/platform-dirs.test.ts

could you fix this and then I will merge this.

@binbandit

Copy link
Copy Markdown
Contributor Author

This is fantastically structured PR, thank you for putting in the effort to make the code clean and adding tests. I do see that ci fails with

Checking formatting...
[warn] src/utils/agent/sandbox/macos-seatbelt.ts
[warn] src/utils/config.ts
[warn] src/utils/platform-dirs.ts
[warn] tests/platform-dirs.test.ts

could you fix this and then I will merge this.

Addressed the format issues

@tibo-openai tibo-openai changed the title Platform-Specific Directory Support feat: platform-specific directory support Apr 17, 2025
@binbandit

Copy link
Copy Markdown
Contributor Author

@tibo-openai Good to go 😃

@tibo-openai

Copy link
Copy Markdown
Collaborator

Please revert the codex-cli/pnpm-lock.yaml and fix the merge conflicts and then I will merge, ty!

@Bakobiibizo

Copy link
Copy Markdown

I had a similar issue. paths using ~ are not being expanded by node causing file paths to silently break. After reviewing this pr and auditing config, sessions, logs, history etc. I found nowhere that a literal ~ could be left unexpanded. This also resolves issues #330 #250 #121 as well.

@binbandit

Copy link
Copy Markdown
Contributor Author

@tibo-openai all yours to merge

@binbandit

Copy link
Copy Markdown
Contributor Author

@fouad-openai @tibo-openai
Might be a good one to get merged

@binbandit

Copy link
Copy Markdown
Contributor Author

oh my lord... these merge conflicts 😅

@delafthi delafthi mentioned this pull request Jun 8, 2025
6 tasks done
@klmr

klmr commented Aug 5, 2025

Copy link
Copy Markdown

Thanks for the great PR. Would it be possible to also add Windows support? Windows has known folders, and in particular %(Local)AppData% for (non-roaming) application data.

@codex-maintainers

Copy link
Copy Markdown

Thanks for the contribution! We're primarily focused on the native/Rust implementation of Codex CLI and would love to see if this is still an issue on the latest version. If it is, we're happy to take a look at a PR to the codex-rs/ implementation.

@github-actions github-actions Bot locked and limited conversation to collaborators Aug 7, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Adhere to the macOS File System Programming Guide on macOS Adhere to XDG Base Desktop Specification on Linux platforms

5 participants