Files
skillshare/internal/utils/link_unix.go
T
Willie d97f6d88b7 fix(trash): keep junctions as junctions when moving across volumes
When the skills source and the trash live on different volumes, the
cross-device fallback in moveLink and copyDir recreated a Windows
junction with os.Symlink. That needs Developer Mode or elevation, which
the junction was chosen to avoid, so `unlink` and `trash restore` could
fail after `link` had succeeded.

Recreate a junction as a junction through a shared helper, and keep the
original link in place when creation fails. CreateJunction moves from
internal/sync to internal/utils so trash can reuse it.

Refs #420
2026-10-06 00:32:38 +08:00

14 lines
410 B
Go

//go:build !windows
package utils
import "fmt"
// platformIsJunction returns false: junctions exist only on Windows.
func platformIsJunction(string) bool { return false }
// CreateJunction cannot recreate a Windows junction on another platform.
func CreateJunction(linkPath, sourcePath string) error {
return fmt.Errorf("cannot restore Windows junction %s to %s on this platform", linkPath, sourcePath)
}