Archive: CreateShortcut truncates name of exe-file


CreateShortcut truncates name of exe-file
Using NSIS 1.96, and the nsi-file template with one small section added for creation of a shortcut, I see that the command is correctly understood from the text in the shell, but in the installarion step the file name is truncated to 8+3.

Section "Shortcuts"
CreateDirectory "f:\users\DanSim"
CreateShortCut "f:\users\DanSim\Sta.lnk" "v:\x86\1234567890.exe"
SectionEnd

gives

V:\x86\12345678.exe

Best regards
Jan Eggert Kofoed


I tested it with this script

name test
outfile test.exe

section
CreateShortCut "$DESKTOP\prob.lnk" "f:\testtesttest.test"
sectionend

and it worked. (It gives indeed f:\testtesttest.test, so 12+4)

I'm not sure what could be the cause of this...

-Hendri.

I have now found a possible explanation for trunctaion to 8+3 file names. If the target file of the link does not (yet) exist Makensis does the truncation. If the file actually exists the correct (longer) name is used. Running the installer twice (or create shortcuts after copying of files, creation of logical drive letters, etc.) will perhaps solve my problem.


Try using to latest NSIS 2 version.


I am now using v2.0b0 and has the problem with that version as well.
The work-around described will suffice.


Still the same problem with the latest version (2.0 beta 2 / beta 3 CVS)?


MakeNSIS doesn't even know you give it a file path. If it happens with b2/3 can you please attach the script, and MakeNSIS.exe output (get it with MakeNSISw)?


I have now
*) downloaded MakeNSIS v2.0b2
*) made a simple installation script based on Example1.nsi, first using a non-existant drive for the target of a shortcut

[edit by kichik]please attach huge scripts/outputs. attached below :down:[/edit]

*) and the properties of the shortcut is now:
C:\windows\temp\batchfilewithalongname.bat

The file C:\windows\temp\batchfilewithalongname.bat does not exist, and neither does the x: drive. It seems that existence of the drive determines the behaviour.

I understand perfectly that NSIS does not recognize the text as being a path, and that is why I have not bothered with ensuring creating the network connection prior to creating the shortcut.

The current test has been made under Windows 98, but the behaviour seems to be the same as previous experiences under Windows 2000 and Windows NT, and with previous NSIS versions.

btw: Thank you very much for a very useful program for creation of installationprograms, and for quick answers to posted questions.
AND
Do you prefer file attachments insted of pasted text?

best regards,
Jan Eggert Kofoed


Yep, please attach large scripts.


My guess is that since the drive doesn't exist Windows can't get the short file name of that file (8.3) and can't be sure a long file name will work because it doesn't know what file system is used. Therefore, it assumes the worst and truncates the name of the file. This is a not a NSIS bug, NSIS just tells Windows what's the path of the file. What Windows does with that file name is beyond NSIS's reach.


Thanx.
Your assumption sounds very reasonable, and makes it easier to remember to map the drive before creating the shortcut.

Best regards,
Jan