mirror of
https://github.com/runkids/skillshare.git
synced 2026-11-20 20:34:19 +00:00
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
14 lines
410 B
Go
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)
|
|
}
|