PortableApps.com wins big in the 2009 Community Choice Awards and hits 100 million app downloads!

Moving directories in NSIS- Need Help

Espreon's picture
Submitted by Espreon on September 26, 2007 - 4:36pm

Alright I am almost finished with MoinMoin Portable Beta 1 but when I launch it a second time it does not work, because the launcher is not moving the "wiki" folder in Data\settings to App\moinmoin

Here is the .nsi:

SkipSplashScreen:
		;=== Check for data files
                IfFileExists `$EXEDIR\Data\settings\wiki\` MoveSettings
                IfFileExists `$EXEDIR\Data\settings\wikiconfig.py` MoveSettings
		IfFileExists `$EXEDIR\Data\settings\*.*` MoveSettings
			CreateDirectory `$EXEDIR\Data\settings`

	MoveSettings:
		Rename `$EXEDIR\Data\settings\wiki\` `$EXEDIR\App\moinmoin\`
        Rename `$EXEDIR\Data\settings\wikiconfig.py` `$EXEDIR\App\moinmoin\wikiconfig.py`

	LaunchNow:
		SetOutPath `$EXEDIR\App\moinmoin`
		ExecWait `$EXEDIR\App\moinmoin\moin.exe`

		;=== Move settings back
                Delete `$EXEDIR\Data\settings\wikiconfig.py`
                Rename "$EXEDIR\App\moinmoin\wikiconfig.py" "$EXEDIR\Data\settings\wikiconfig.py"
                RMDir /r `$EXEDIR\Data\settings\wiki`
                Rename "$EXEDIR\App\moinmoin\wiki" "$EXEDIR\Data\settings\wiki"

What is the correct way of using the Rename command to move directories?


( categories: )

Cut out the website line...

In your code and I'll help.

This line, VIAddVersionKey Comments "Allows ${APP} to be run from a removable drive. For additional details, visit ${WEBSITE}"
_______________________________________________
Wow, I just noticed I still had a signature, that's enough of that.

Done.

" "

--
As all of ya should know Micro$oft is the Evil Empire, and Windows (a.k.a. Winblows or Windoze) is their greatest general, so please make a difference and install Linux or FreeBSD on yer Windows comp.

*In a high singing voice* All the little creatures of the forest!

and stuff...

No I mean here silly.

The pre-formatted code you posted, you screwed up the page. Sticking out tongue

_______________________________________________
Wow, I just noticed I still had a signature, that's enough of that.

Here you are moving from

Here you are moving from \settings\wiki\ to \moinmoin\ -

MoveSettings:
	Rename `$EXEDIR\Data\settings\wiki\` `$EXEDIR\App\moinmoin\`

Here you are moving from \moinmoin\wiki\ to \settings\wiki\, but your source dir does not exist.

        Rename "$EXEDIR\App\moinmoin\wiki" "$EXEDIR\Data\settings\wiki"

Also note that the Rename operation will fail if the destination file\folder exists (per NSIS documentation).