Archive: Trouble with GetFullPathName


Trouble with GetFullPathName
Hello,

I'm using NSIS 2.06 and there's a place in my code where GetFullPathName doesn't seem to work.

I'm using the MUI interface and call the MUI_DIRECTORY_PAGE this way :

!define MUI_PAGE_CUSTOMFUNCTION_PRE                     Defaults.onPreDirPage
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE Defaults.onLeaveDirPage
!insertmacro MUI_PAGE_DIRECTORY


In the Defaults.onLeaveDirPage, I need to be sure that $INSTDIR is a full path so I do :

Function Defaults.onLeaveDirPage
Push $R0 ; The return value of the function 'FileOrDirStatus'
Push $R1

GetFullPathName $INSTDIR $INSTDIR

; Determines the status of the installation directory
${FileOrDirStatus} $R0 "$INSTDIR"
${Select} "$R0"
${Case2} "empty" "does not exist"
${CaseElse}
${IfCmd} MessageBox MB_YESNO|MB_ICONQUESTION $(Defaults_Ask_InstDirNotEmpty) IDNO ${||} StrCpy $ABORT_FLAG "true" ${|}
${EndSelect}

${Unless} "$ABORT_FLAG" == "true"
WriteIniStr "$PLUGINSDIR\${UNINSTALL_INI_FILE}" "Main.data" "InstallDirectory" "$INSTDIR"
${EndUnless}

Pop $R1
Pop $R0
Call Defaults.abortIfRequired
FunctionEnd


But this doesn't work as I've always INSTDIR as a short path if I type it as a short path on the MUI_DIRECTORY_PAGE.

I've try the following things without success:

1.
GetFullPathName $R1 "$INSTDIR"
StrCpy $INSTDIR $R1

2.
GetFullPathName $R1 $\"$INSTDIR$\"
StrCpy $INSTDIR $R1

3.
GetFullPathName $INSTDIR "$INSTDIR"

I can't see what to try now to make this work. Any idea ?

Call GetLongPathName using the System plug-in.


Thank you Kichik, I'll try this.