fix: complete Windows compatibility for path handling in qmd.ts#143
Open
faisalkindi wants to merge 2 commits intotobi:mainfrom
Open
fix: complete Windows compatibility for path handling in qmd.ts#143faisalkindi wants to merge 2 commits intotobi:mainfrom
faisalkindi wants to merge 2 commits intotobi:mainfrom
Conversation
- Use USERPROFILE fallback when HOME env var is not set (Windows cmd.exe) - Replace Unix-only `mkdir -p` shell command with cross-platform mkdirSync - Add Windows fallback for sqlite-vec DLL loading via absolute path - Point bin entry to src/qmd.ts so bun shim works on Windows Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Building on PR tobi#137's store.ts fixes, this addresses the remaining Windows compatibility issues in qmd.ts: - Replace all startsWith('/') checks with isAbsolutePath() to handle Windows drive letters (C:\) - Normalize backslash paths with normalizePathSeparators() before split('/') operations throughout the codebase - Fix collection path matching in detectCollectionFromPath() to normalize both real paths and collection paths - Use cmd /c on Windows instead of bash -c for custom update commands These changes, combined with PR tobi#137, resolve all 8 issues from tobi#31. Fixes tobi#31
Author
Testing Results on Windows 11Tested on Windows 11 x64 with Bun v1.3.9: ✅ Working
|
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.
Summary
Building on PR #137's
store.tsfixes (HOME fallback, mkdirSync, sqlite-vec DLL, bin entry), this PR addresses the remaining Windows compatibility issues inqmd.tsto fully resolve #31.Changes
Path resolution (
startsWithchecks)startsWith('/')absolute path checks withisAbsolutePath()(already exported fromstore.ts) which correctly handles Windows drive letters (C:\,D:\) and Git Bash paths (/c/)contextAdd,contextRemove,getDocument,listFilesPath normalization (
splitoperations)normalizePathSeparators()before allsplit('/')operations on filesystem paths to handle Windows backslashescomputeDisplayPath,getDocument,listFiles,collectionAdd,detectCollectionFromPathCollection path matching
detectCollectionFromPath()soC:\Users\...matches correctly against stored collection pathsShell command spawning
cmd /con Windows instead of/usr/bin/env bash -cfor custom collection update commandsCombined with PR #137, this resolves all 8 issues from #31:
.ts(PR fix: Windows compatibility for HOME path, mkdir, and sqlite-vec loading #137)mkdir -p→mkdirSync(PR fix: Windows compatibility for HOME path, mkdir, and sqlite-vec loading #137)isAbsolutePath()(this PR)/separators →normalizePathSeparators()(this PR)Test plan
isAbsolutePath()andnormalizePathSeparators()from store.ts (merged in Add Windows path utilities with cross-platform test coverage #51)Fixes #31