git-for-windows/git-sdk-64

`sdk create-desktop-icon` fails with "Could not save link"

jnareb opened this issue · 3 comments

During Git SDK for Windows installation (from git-sdk-installer-1.0.7-64.7z.exe file), and later when trying to run sdk create-desktop-icon I get the following error:

Could not save link
Error: System could not find the given path.

The Git SDK icon failed to appear on the desktop, either.

(the error message is loosely translated from the localized error message).

dscho commented

This error comes from here: https://github.com/git-for-windows/build-extra/blob/f9dbc27db658c0ddcf2f10bac2122fcef88d5133/git-extra/create-shortcut.c#L105

Maybe you can build this program from scratch (possibly instrumenting the code, like e.g. printing the err_code here) and call it manually to figure out what is going wrong.

To find out which call is actually made, call (set -x && sdk create-desktop-icon).

$ (set -x && sdk create-desktop-icon)
+ sdk create-desktop-icon
+ case "$1" in
+ force=t
+ case "$1" in
+ shift
+ case "$1" in
+ break
+ case "$(uname -m)" in
++ uname -m
+ bitness=' 64-bit'
+ desktop_icon_path='C:\Users\mateusz/Desktop/Git SDK 64-bit.lnk'
+ test -n t
+ create-shortcut.exe --icon-file /msys2.ico --work-dir / /git-bash.exe 'C:\Users\mateusz/Desktop/Git SDK 64-bit.lnk'
Could not save link
Error: System nie mo┐e odnalečŠ okreťlonej ťcie┐ki. # yeah, runtime is still broken

In my case (user created with Microsoft account) the desktop location is: /c/Users/mateusz/OneDrive/Pulpit. Pulpit is polish translation of Desktop.

Could it be roughly here that may need adjusting?

                desktop_icon_path="$USERPROFILE/Desktop/Git SDK$bitness.lnk" &&
		if test -n "$force" || test ! -f "$desktop_icon_path"
		then
			create-shortcut.exe --icon-file /msys2.ico --work-dir \
				/ /git-bash.exe "$desktop_icon_path"
		fi