mirror of
https://github.com/runkids/skillshare.git
synced 2026-11-19 02:17:09 +00:00
- Add detailed error messages when junction/symlink creation fails - Pre-flight checks for source existence and target conflicts - Capture mklink /J stderr output - Show both junction and symlink failure reasons - Add case-insensitive path comparison for Windows (NTFS) - New PathsEqual() and PathHasPrefix() in utils/path.go - Fix 8 path comparisons that could fail due to case differences - Affects sync, pull, target remove, diff, and doctor commands
27 lines
690 B
Go
27 lines
690 B
Go
package utils
|
|
|
|
import (
|
|
"runtime"
|
|
"strings"
|
|
)
|
|
|
|
// PathsEqual compares two paths for equality.
|
|
// On Windows, paths are compared case-insensitively since NTFS is case-insensitive.
|
|
// On Unix systems, paths are compared exactly.
|
|
func PathsEqual(a, b string) bool {
|
|
if runtime.GOOS == "windows" {
|
|
return strings.EqualFold(a, b)
|
|
}
|
|
return a == b
|
|
}
|
|
|
|
// PathHasPrefix checks if path starts with prefix.
|
|
// On Windows, comparison is case-insensitive.
|
|
// On Unix systems, comparison is exact.
|
|
func PathHasPrefix(path, prefix string) bool {
|
|
if runtime.GOOS == "windows" {
|
|
return strings.HasPrefix(strings.ToLower(path), strings.ToLower(prefix))
|
|
}
|
|
return strings.HasPrefix(path, prefix)
|
|
}
|