Skip to content

Conversation

@antimora
Copy link
Collaborator

@antimora antimora commented Jan 23, 2026

Replace dirs::home_dir().join(".cache") with dirs::cache_dir() for cross-platform compatibility. This respects platform conventions and environment variables like $XDG_CACHE_HOME on Linux.

The codebase was using dirs::home_dir().join(".cache") which is Linux-specific. This PR switches to dirs::cache_dir() which returns the platform-appropriate cache directory:

Platform Path
Linux $XDG_CACHE_HOME or ~/.cache
macOS ~/Library/Caches
Windows {FOLDERPATH_LOCAL_APPDATA}

Pull Request Template

Checklist

  • Confirmed that cargo run-checks command has been executed.
  • Made sure the book is up to date with changes in this PR.

Related Issues/PRs

N/A

Changes

  • Replace dirs::home_dir().join(".cache") with dirs::cache_dir() for cross-platform compatibility
  • Update documentation to reflect the change

Testing

Tested mnist example to make sure the cache is saved under ~/Library/Caches on mac

Breaking

Can redownload or alert missing files in ~/.cache path

Replace dirs::home_dir().join(".cache") with dirs::cache_dir() for
cross-platform compatibility. This respects platform conventions and
environment variables like $XDG_CACHE_HOME on Linux.
@antimora antimora self-assigned this Jan 23, 2026
@antimora antimora added the enhancement Enhance existing features label Jan 23, 2026
@antimora antimora changed the title Use cache_dir() instead of hardcoded ~/.cache path Use cache_dir() instead of hardcoded ~/.cache path Jan 23, 2026
@antimora antimora requested review from Copilot, laggui and nathanielsimard and removed request for Copilot January 23, 2026 19:15
Copy link
Member

@laggui laggui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable.

Though it will break the current cache for macOS and Windows users, and linux users that set $XDG_CACHE_HOME. So we will have to note the breaking change.

@codecov
Copy link

codecov bot commented Jan 23, 2026

Codecov Report

❌ Patch coverage is 77.77778% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.87%. Comparing base (3cd0671) to head (1fb7d44).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
crates/burn-dataset/src/vision/mnist.rs 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4372      +/-   ##
==========================================
+ Coverage   68.86%   68.87%   +0.01%     
==========================================
  Files        1412     1412              
  Lines      168245   168243       -2     
==========================================
+ Hits       115857   115874      +17     
+ Misses      52388    52369      -19     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@antimora antimora merged commit 84e9459 into tracel-ai:main Jan 24, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Enhance existing features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants