feat(linux): update font path to XDG spec and refresh cache#41
Merged
feat(linux): update font path to XDG spec and refresh cache#41
Conversation
- Use ~/.local/share/fonts (or /fonts) for Linux installs. - Execute fc-cache -f post-install to update the system font list.
There was a problem hiding this comment.
Additional Comments (1)
-
lib/system-font.js, line 36 (link)style: CI workflow
.github/workflows/ci.yml:36creates~/.fontsbut should create~/.local/share/fontsto match new XDG pathNote: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
1 file reviewed, 2 comments
Comment on lines
+166
to
+167
| const xdgDataHome = process.env.XDG_DATA_HOME || path.join(os.homedir(), '.local', 'share'); | ||
| const linuxDestFolder = path.join(xdgDataHome, 'fonts'); |
There was a problem hiding this comment.
style: README.md still references old ~/.fonts path (lines 56, 187, 364). Update docs to reflect new XDG path ~/.local/share/fonts
Prompt To Fix With AI
This is a comment left during a code review.
Path: lib/system-font.js
Line: 166:167
Comment:
**style:** README.md still references old `~/.fonts` path (lines 56, 187, 364). Update docs to reflect new XDG path `~/.local/share/fonts`
How can I resolve this? If you propose a fix, please make it concise.
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.
Greptile Summary
This PR modernizes Linux font installation by adopting the XDG Base Directory specification and adding automatic font cache refresh functionality.
Key Changes:
~/.fonts/to XDG-compliant~/.local/share/fonts(respects$XDG_DATA_HOMEenvironment variable)fc-cache -fexecution after font installation to automatically refresh the system font cachefc-cacheis graceful - if the command fails or isn't available, the font is still successfully savedDocumentation Gaps:
~/.fontspath in multiple locations (lines 56, 187, 364)~/.fontsdirectory instead of the new XDG pathThe implementation itself is solid with proper error handling, but supporting documentation and CI configuration need updates to maintain consistency.
Confidence Score: 4/5
Important Files Changed
Sequence Diagram
sequenceDiagram participant User participant SystemFont participant FileSystem participant OS participant fcCache as fc-cache User->>SystemFont: install(remoteFile, fileName) alt Platform: Linux SystemFont->>OS: Get XDG_DATA_HOME env alt XDG_DATA_HOME exists OS-->>SystemFont: $XDG_DATA_HOME value else XDG_DATA_HOME not set SystemFont->>OS: os.homedir() OS-->>SystemFont: ~/.local/share (default) end SystemFont->>SystemFont: linuxDestFolder = xdgDataHome/fonts SystemFont->>SystemFont: saveAt(remoteFile, linuxDestFolder, fileName) SystemFont->>FileSystem: Download and save font FileSystem-->>SystemFont: Font saved successfully SystemFont->>fcCache: exec('fc-cache -f') alt fc-cache succeeds fcCache-->>SystemFont: Cache refreshed else fc-cache fails fcCache-->>SystemFont: Error (silently caught) Note over SystemFont: Font already saved, continue end SystemFont-->>User: Font path else Platform: Darwin/Windows Note over SystemFont: Use platform-specific paths end