isPrivilegeError reports whether err indicates symlink creation was denied for lack of privilege (the Windows non-developer-mode case).
(err error)
| 24 | // isPrivilegeError reports whether err indicates symlink creation was denied |
| 25 | // for lack of privilege (the Windows non-developer-mode case). |
| 26 | func isPrivilegeError(err error) bool { |
| 27 | if err == nil { |
| 28 | return false |
| 29 | } |
| 30 | if strings.Contains(strings.ToLower(err.Error()), "privilege") { |
| 31 | return true |
| 32 | } |
| 33 | // syscall.Errno on Windows compares equal to the numeric code. |
| 34 | type numbered interface{ Errno() uintptr } |
| 35 | var n numbered |
| 36 | if errors.As(err, &n) && n.Errno() == windowsPrivilegeNotHeld { |
| 37 | return true |
| 38 | } |
| 39 | return false |
| 40 | } |
| 41 | |
| 42 | // Install links the instruction identified by id into the coding-agent path |
| 43 | // for (app, level, projectDir), using a symlink with a copy fallback. |