You are here

Renaming Files after Extraction in Installer

8 posts / 0 new
Last post
Devo
Offline
Last seen: 1 year 1 month ago
Joined: 2007-09-04 14:55
Renaming Files after Extraction in Installer

I've been working on a launcher for Dropbox and I think I'm running into an issue with the installer. I've been able to download and extract folders using installer.ini, but I have to do some post install code to clean everything up. The issue I'm having is that when the file is extracted the folders have system variable names so I'm thinking I won't be able to rename things properly. Can somebody take a look at what I've got and let me know if this will work or not.

!macro CustomCodePostInstall

Rename "$INSTDIR\App\Dropbox\$0\Dropbox\$INSTDIR\gdiplus.dll" "$INSTDIR\App\Dropbox\gdiplus.dll"
Rename "$INSTDIR\App\Dropbox\$APPDATA\Dropbox\bin\$INSTDIR\*.dll" "$INSTDIR\App\Dropbox\*.dll"
Rename "$INSTDIR\App\Dropbox\$INSTDIR\*.*" "$INSTDIR\App\Dropbox\*.*"
Rename "$INSTDIR\App\Dropbox\update\$PLUGINSDIR\nsExec.dll" "$INSTDIR\App\Dropbox\nsExec.dll"

RMDir /r "$INSTDIR\App\Dropbox\$0"
RMDir /r "$INSTDIR\App\Dropbox\$APPDATA"
RMDir /r "$INSTDIR\App\Dropbox\$INSTDIR"
RMDir /r "$INSTDIR\App\Dropbox\$PLUGINSDIR"
RMDir /r "$INSTDIR\App\Dropbox\update"

Clearerrors
!macroend
Mark Sikkema
Offline
Last seen: 13 years 3 months ago
Developer
Joined: 2009-07-20 14:55
Just double the dollar sign,

Just double the dollar sign, it's an escape character:

!macro CustomCodePostInstall

Rename "$INSTDIR\App\Dropbox\$$0\Dropbox\$$INSTDIR\gdiplus.dll" "$INSTDIR\App\Dropbox\gdiplus.dll"
Rename "$INSTDIR\App\Dropbox\$$APPDATA\Dropbox\bin\$$INSTDIR\*.dll" "$INSTDIR\App\Dropbox\*.dll"
Rename "$INSTDIR\App\Dropbox\$$INSTDIR\*.*" "$INSTDIR\App\Dropbox\*.*"
Rename "$INSTDIR\App\Dropbox\update\$$PLUGINSDIR\nsExec.dll" "$INSTDIR\App\Dropbox\nsExec.dll"

RMDir /r "$INSTDIR\App\Dropbox\$$0"
RMDir /r "$INSTDIR\App\Dropbox\$$APPDATA"
RMDir /r "$INSTDIR\App\Dropbox\$$INSTDIR"
RMDir /r "$INSTDIR\App\Dropbox\$$PLUGINSDIR"
RMDir /r "$INSTDIR\App\Dropbox\update"

Clearerrors
!macroend

But, if I recall correctly, you can not do Rename with wildcards, try CopyFiles or full file-names.

Formerly Gringoloco
Windows XP Pro sp3 x32

Devo
Offline
Last seen: 1 year 1 month ago
Joined: 2007-09-04 14:55
You were right about the

You were right about the wildcards. I got everything to install properly, now I just have to figure out how to edit the Dropbox preferences with the launcher, I can't seem to find where they're stored. Any ideas?

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 6 months ago
Joined: 2007-04-15 21:08
Regshot

With scanning all of drive C and the drive you're running from too if it's not C.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

Devo
Offline
Last seen: 1 year 1 month ago
Joined: 2007-09-04 14:55
Can launcher edit db file

I was able to find where the folder path is stored, config.db. Is there a way for the launcher to edit a db file?

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 6 months ago
Joined: 2007-04-15 21:08
Contents

It depends entirely on the contents of the db file. What is it - plain text? SQLite database?

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

Devo
Offline
Last seen: 1 year 1 month ago
Joined: 2007-09-04 14:55
SQLite format 3

It's an SQLite database. I was able to find the path in the file, but I don't know if the launcher will be able to update the file with the new drive letter.

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 6 months ago
Joined: 2007-04-15 21:08
Songbird

Take a look at how Songbird handles it. On my distant-future feature list for PAL I have SQLite database management (using the SQLite DLL rather than the executable), but for the moment you can write custom code to work with sqlite3.exe.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

Log in or register to post comments