A universal Agent whose obsolete private copy cannot be retired installs nothing there, yet every entry point counted that retirement failure as an install failure — aborting `npm install`, `dws skill setup`, and the shell installers even when the canonical store and all links published correctly, and skipping the skills-state write. Route retirement failures to a separate warning path across all surfaces (Go upgrade + skill setup, npm, PowerShell, install.sh, install-skills.sh, install-event.sh, install-devapp.sh). Also: - Add a checked-rename fallback for filesystems that reject the atomic no-replace flag (NFS, FUSE, overlayfs); the no-clobber contract is kept and the previously unsupported platforms build and work. - PowerShell multi-mode links only bundle skills, never the shared canonical store, so third-party/user skills are no longer fanned into every Agent root. - Prune ~/.dws/skill-backups to the newest 5 on every surface; encode HOME-relative backup names on PowerShell to preserve origin. - Add simulated-win32 junction coverage and rewrite the tautological no-replace test; remove dead code whose tests gave false coverage. - Soften the overstated Windows ownership-proof comment (NTFS tunneling).
23 lines
609 B
Go
23 lines
609 B
Go
//go:build windows
|
|
|
|
package upgrade
|
|
|
|
import "golang.org/x/sys/windows"
|
|
|
|
func renameSkillPathNoReplaceAtomic(source, destination string) error {
|
|
sourcePtr, err := windows.UTF16PtrFromString(source)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
destinationPtr, err := windows.UTF16PtrFromString(destination)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return windows.MoveFile(sourcePtr, destinationPtr)
|
|
}
|
|
|
|
// MoveFile without MOVEFILE_REPLACE_EXISTING already refuses an occupied
|
|
// destination on every supported Windows version, so there is nothing to
|
|
// degrade to.
|
|
func isNoReplaceRenameUnsupported(error) bool { return false }
|