Skip to content

fix: improve cross-platform compatibility for macOS and Linux#95

Open
mitre88 wants to merge 1 commit intopablodelucca:mainfrom
mitre88:fix/macos-linux-compatibility
Open

fix: improve cross-platform compatibility for macOS and Linux#95
mitre88 wants to merge 1 commit intopablodelucca:mainfrom
mitre88:fix/macos-linux-compatibility

Conversation

@mitre88
Copy link

@mitre88 mitre88 commented Mar 8, 2026

Summary

Improves cross-platform robustness for macOS and Linux, addressing the "Windows-only testing" known limitation noted in the README.

Changes

1. Graceful fs.watch error handling (fileWatcher.ts)

  • Added error event handler on the fs.watch watcher to prevent unhandled errors from crashing the extension
  • On Linux, fs.watch can fail with ENOSPC when the system runs out of inotify watchers — the error message now includes a hint to increase fs.inotify.max_user_watches
  • The existing triple-redundancy (fs.watch + fs.watchFile + polling) already provides excellent macOS support; this change ensures errors are handled cleanly rather than potentially propagating

2. Cross-platform asset path normalization (assetLoader.ts)

  • The furniture catalog JSON stores file paths with POSIX separators (/). The path comparison (startsWith("assets/")) worked correctly, but the resolved path could theoretically mix separators on Windows
  • Now normalizes catalog paths using path.posix/path.win32 and splits on / when joining, ensuring consistent behavior across all platforms

3. Platform logging on startup (PixelAgentsViewProvider.ts)

  • Logs process.platform and process.arch at startup for easier debugging of platform-specific issues

4. Layout watcher error logging (layoutPersistence.ts)

  • The fs.watch error handler for the layout file watcher previously swallowed errors silently — now logs them for debugging

Testing

  • ✅ Full build (npm run build) passes on macOS (arm64, Darwin)
  • ✅ TypeScript type-checking passes
  • ✅ ESLint passes (via lint-staged)
  • ✅ All changes are backwards-compatible — no behavioral changes on Windows

Notes

After reviewing the codebase thoroughly, the extension is already well-architected for cross-platform use:

  • All file paths use path.join() consistently
  • File watching already uses triple redundancy (fs.watch + fs.watchFile + manual polling)
  • The project directory naming (getProjectDirPath) matches Claude Code's own convention across platforms

These changes are defensive improvements that handle edge cases (fs.watch errors, path normalization) and improve debuggability on non-Windows platforms.

- Handle fs.watch errors gracefully with platform-specific guidance
  (e.g., inotify limit hint on Linux)
- Normalize asset file paths using path.posix/path.win32 for consistent
  cross-platform path handling in furniture catalog loading
- Add platform/arch logging on startup for easier debugging
- Log fs.watch errors in layout file watcher instead of silently swallowing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant