Skip to content
⌘ NSIS Forum Archive

Locate function - bug with relative paths?

6 posts

Guest#

Locate function - bug with relative paths?

Hi all!

There seems to be a bug in the Locate Function in FileFunc.nsh.

If I call it like this it works perfectly:

${Locate} "C:\installer\files\sys\plugins" "/M=com.fsp.f20.fu20.common_*" "getDirFullPath"

If I try this (and this is what I actually need, unfortunately) it doesn't:

${Locate} "..\files\sys\plugins" "/M=com.fsp.f20.fu20.common_*" "getDirFullPath"

Is there a work-around or a fix that one of you could offer?

Thanks in advance

Jim
Guest#
Hmm, unfortunately I have to use a relative path. All the install script can be sure of at execution time is that the "files" directory will be next to it: ..\files.

Jim
Afrow UK#
If you have to use relative paths (which I would not recommened) use SetOutPath $EXEDIR to set the correct working directory first.

-Stu
Instructor#
I see no relative path problem. Make sure that "..\files\sys\plugins" exists, put this code before Locate function call:

IfFileExists "..\files\sys\plugins\*.*" +2
MessageBox MB_OK "This directory isn't exist"

${Locate} "..\files\sys\plugins" "/M=com.fsp.f20.fu20.common_*" "getDirFullPath"
If it not exist, use like say Afrow UK "SetOutPath $EXEDIR"
Guest#
You are right, Instructor. Your function works fine. I made a stupid mistake and found out just now. My apologies!

Thanks again

Jim