Archive: SetOutPath Problem


SetOutPath Problem
For the group of my installers, I've made a custom plugin. In one of my installers I am executing some backup scripts before uninstalling and then re-installing to a new version. Within this backup area, I extract out 2 files. My plugin will fail to load into the installer if I run the function that does the backup first. I commented out line by line and determined that the SetOutPath was causing this problem. I can't attach my code, but I can give an example.


Function .onInit
...
Call CheckForPreviousInstall
${If} $PreviousInstall == "true"
Call backupdatabase
Call UninstallPrevious
${EndIf}
FunctionEnd

Function backupdatabase
...
; R1 contains the previous install directory

StrCpy $R0 $WINDIR 2 0
SetOutPath "$R1\bin"
; Extract files
; Execute script
FunctionEnd
...
Section SEC001
ClearErrors
my-plugin::dosomething
${If} ${Errors}
MessageBox MB_OK "Error"
${EndIf}
SectionEnd

In SEC001, my-plugin::dosomething fails ONLY when the SetOutPath statement is being executed in the function backupdatabase. I don't know if I'm doing something stupid, if there's a known issue (or unknown issue), or a quick fix. Any help would be appreciated because I currently have a workaround.

Thanks in advance!

SetOutPath also sets the working directory. That may interfere with your plug-in for some reason. Maybe it can't find a dependency which is only available in $EXEDIR. Try SetOutPath $EXEDIR before calling the plug-in.


I feel dumb now. I was extracting some dependencies to $PLUGINSDIR and the outpath wasn't being set back there. Thanks!