Jonathan Henson
Jonathan Henson

Reputation: 8206

NSIS DELETE command not working

I am deploying gstreamer winbuilds along side an application. The main problem is that the gstreamer winbuilds installation is broken. The python bindings don't work and it complains every time you initialize gstreamer with annoying popups. So, I figured out that I could just delete the "libgstpython-v2.6.dll" from the lib folder to fix the problem. However, NSIS will not delete the file. Note, I am certain that the path is correct.

Here is the code:

ReadRegStr $0 HKLM 'SOFTWARE\OSSBUILD\GStreamer' InstallDir
ReadRegStr $3 HKLM 'SOFTWARE\Wow6432Node\OSSBUILD\Gstreamer' InstallDir

${If} $0 == '' 
 ${AndIf} $3 == ''
    DetailPrint 'The HHPVideoServer plugin depends on Gstreamer, we will need to install the core Gstreamer Components.'
    DetailPrint 'Installing Gstreamer.'
    ExecWait '"msiexec" /i "$INSTDIR\GStreamer-WinBuilds-GPL-x86-Beta04-0.10.7.msi" /q /norestart' $1
    DetailPrint 'Finished installing Gstreamer with error code $1' 

    ReadRegStr $0 HKLM 'SOFTWARE\OSSBUILD\GStreamer' InstallDir
    ReadRegStr $3 HKLM 'SOFTWARE\Wow6432Node\OSSBUILD\Gstreamer' InstallDir

    ${If} $0 != ''
        DetailPrint 'Gstreamer Plugins installed to $0'
        DetailPrint 'Deleting $0lib\gstreamer-0.10\libgstpython-v2.6.dll'
        DELETE '$0lib\gstreamer-0.10\libgstpython-v2.6.dll''
    ${ElseIF} $3 != ''
        DetailPrint 'Gstreamer Plugins installed to $3'
        DetailPrint 'Deleting $3lib\gstreamer-0.10\libgstpython-v2.6.dll'
       DELETE '$3lib\gstreamer-0.10\libgstpython-v2.6.dll'
    ${EndIf}

${Else}
    DetailPrint 'Gstreamer already installed.'
${EndIf}

The delete call never works. If I manually delete the file, it fixes the error messages for gstreamer. Also, the installer is running with administrator permissions.

Upvotes: 0

Views: 699

Answers (1)

RyanE
RyanE

Reputation: 425

Hi can you just do a quick test?

Add the following lines after you make the delete calls in both places:

IfErrors 0 +2
DetailPrint 'There was an error trying to delete the file!'

This will let us know if it is trying to delete the file and it can't or if it is not finding the file. Delete only throws an error when it finds the file AND it can't delete it.

If you do end up getting an error then the next step is trying to figure out what program or service is using the DLL when you try to delete it.

Upvotes: 1

Related Questions