Skip to content

Windows cross-platform compatibility fixes #30

@bilersan

Description

@bilersan

Summary

ctx currently has several assumptions that break on Windows:

  1. Path boundary validationValidateBoundary uses case-sensitive path comparison, but on Windows, VS Code lowercases drive letters (e.g. c:\) while filepath.EvalSymlinks returns uppercase (C:\). This causes false boundary violations.

  2. Project slug generationProjectSlug uses OS-native path separators and includes Windows drive prefixes (C:) in slugs, producing platform-dependent identifiers instead of consistent forward-slash paths.

  3. Session path parsing — The recall parser uses filepath.Separator and filepath.Join for session paths, but these are always stored with forward slashes regardless of OS.

  4. Journal source linksInjectSourceLink and GenerateZensicalToml emit backslash paths on Windows, breaking Markdown links and navigation items.

  5. Feed generation — Uses literal \n and .md strings instead of the config.NewlineLF and config.ExtMarkdown constants.

  6. Test portability — 50+ tests fail on Windows due to:

    • Missing USERPROFILE env var (os.UserHomeDir reads USERPROFILE on Windows, not HOME)
    • Missing APPDATA env var (XDG fallback reads APPDATA on Windows)
    • t.Setenv("TZ", "UTC") has no effect on Windows (time.Local is not re-read from env)
    • Hardcoded Unix paths in test assertions
    • Unix-specific test patterns: /bin/sh shebang, 0755 permissions, : PATH separator, /tmp/ paths

Proposed Fix

  • Case-insensitive path comparison on Windows for boundary validation
  • Platform-independent slug generation with filepath.ToSlash and drive prefix stripping
  • Forward-slash-only session path operations
  • Normalized forward slashes in generated links and nav items
  • Use existing platform constants for newlines and extensions
  • Cross-platform test helpers: setLocalUTC, USERPROFILE/APPDATA env setup, conditional permission skips, platform-aware PATH separators and binary extensions

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions