Skip to content

fix: normalize backslash path separators for Windows - #19

Merged
runkids merged 1 commit into
mainfrom
fix/filepath-issue-on-windows
Feb 10, 2026
Merged

runkids merged 1 commit into
mainfrom
fix/filepath-issue-on-windows

Conversation

@runkids

@runkids runkids commented Feb 10, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes #18 — on Windows, filepath.Join produces backslash (\) separators that were written directly into .gitignore and JSON metadata files, causing:

  • Git pattern matching failures (git only recognizes /)
  • Corrupted source URLs during skillshare update

Changes:

  • Normalize \ → / in UpdateGitIgnore / RemoveFromGitIgnore entry parameter
  • Normalize discoverSkills relative paths (matching existing pattern in sync.go)
  • Replace filepath.Join with / concatenation for fullSubdir in InstallFromDiscovery
  • Normalize Subdir in NewMetaFromSource before writing to metadata JSON

Uses strings.ReplaceAll(s, "\\", "/") instead of filepath.ToSlash — consistent with the existing pattern in sync.go and testable on all platforms.

Test plan

  • 4 new unit tests simulate Windows backslash paths and verify forward-slash output
  • Full test suite passes (unit + integration)

On Windows, filepath.Join produces backslash separators that were
written directly into .gitignore and JSON metadata files. Git does
not match backslash patterns, and metadata subdirs with backslashes
corrupt source URLs during updates.

Use strings.ReplaceAll(s, "\\", "/") at write boundaries — matching
the existing pattern in sync.go — to ensure config/metadata files
always contain forward slashes regardless of OS.
@runkids runkids mentioned this pull request Feb 10, 2026
@runkids
runkids merged commit e8a3c57 into main Feb 10, 2026
6 checks passed
@runkids
runkids deleted the fix/filepath-issue-on-windows branch February 10, 2026 19:41
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.

Backslash on Windows

1 participant