Skip to content
⌘ NSIS Forum Archive

Short pathnames (not 8.3)

5 posts

yugemos#

Short pathnames (not 8.3)

I am having trouble getting a full path name (ie not 8.3) for my installer. For some unknown reason, the software I'm configuring (PHP) doesn't cope with ~'s too well, so I need to write to the configuration file using long path names.

I am using NSIS v2.0b3 and this is the code extract that does not seem to be functioning (the ReplaceInFile macro is from the NSIS Archive)
GetFullPathName $1 $TEMP
!insertmacro ReplaceInFile "$INSTDIR\Apache\php.ini" "§Temp§" "$1"
However, this writes the following to php.ini
session.save_path = C:\DOCUMEN~1\ADMINI~1\LOCALS~1\Temp
Is this how GetFullPathName should be used?
Any suggestions welcome! The full file is attached.

Thanks in advance,
Stefan Norman
Joost Verburg#
Note that the GetFullPathName command does something else, it does not convert short files names to long file names.

You can call the GetLongPathName API using the System plug-in. However, this is not supported on Windows 95/NT4. If you want it to be compatible with Windows 95/NT4, you have to find another solution.
yugemos#
Sorry, I'm new to NSIS and I haven't used windows for tasks like this before.
Could you please explain how I would do this exactly?
Joel#
lol even I didn't understand 🧟
Well, you can first check all about the APIs...
then... check the info in ${NSISDIR}\Contrib\System
In there you'll find the info. about the system.dll plugin...
Also check in this web archive about how to use extra features
about the plugin...
kichik#
This will only work on Windows 98+ and 2000+.

StrCpy $0 "C:\Progra~1"
StrCpy $1 ""
System::Call "Kernel32::GetLongPathNameA(t '$0', &t .r1, i \
${NSIS_MAX_STRLEN}) i .s"
Pop $0
IntCmp $0 ${NSIS_MAX_STRLEN} +2 +2 0
Abort "failed!"
DetailPrint "$0 - $1"