Hi,
I need to move a certain folder when the program is running on a 32-bit system and a different folder when on 64-bit system. Lets call them folder_32 & folder_64 respectively. 
Custom.nsh
${SegmentFile}
${Segment.OnInit}
	; Borrowed the following from PAL 2.2, Remove on release of PAL 2.2
		; Work out if it's 64-bit or 32-bit
	System::Call kernel32::GetCurrentProcess()i.s
	System::Call kernel32::IsWow64Process(is,*i.r0)
	${If} $0 == 0
		StrCpy $Bits 32
	${Else}
		StrCpy $Bits 64
	${EndIf}
!macroend
${SegmentInit}
	${If} $Bits = 64
		${SetEnvironmentVariablesPath} folderG "$EXEDIR\Data\folder_64"
	${Else}
		${SetEnvironmentVariablesPath} folderG "$EXEDIR\Data\folder_32"
	${EndIf}
!macroend
and in AppsNamePortable.ini
[DirectoriesMove]
folderG=%PAL:APPDIR%\AppNamePortable\folder
for some reason it does not move folder_32 or folder_64 depending on the system.
 
      
 Visit the Community page
 Visit the Community page Join our forums
 Join our forums Subscribe to our email newsletter
 Subscribe to our email newsletter Subscribe with RSS
 Subscribe with RSS Follow us on BlueSky
 Follow us on BlueSky Follow us on Facebook
 Follow us on Facebook Follow us on LinkedIn
 Follow us on LinkedIn Follow us on Mastodon
 Follow us on Mastodon
In that case, what is> happening?
Since folderG is an environment variable, it should be listed as %folderG% within your launcher INI.
Sometimes, the impossible can become possible, if you're awesome!
Tried it both ways. No results.
If I remember correctly, the left hand side of the = sign in Launcher ini can not be a variable.
I try to convert what you want to the following custom code.
btw if you are using the latest version of "PortableApps.com Launcher", the ${Segment.OnInit} part need not anymore as it has been build in now.
==========================================================
${SegmentFile}
Var folderG
${SegmentInit}
${If} $Bits = 64
StrCpy $folderG "$EXEDIR\Data\folder_64"
${Else}
StrCpy $folderG "$EXEDIR\Data\folder_32"
${EndIf}
!macroend
${SegmentPreExecPrimary}
${If} ${FileExists} "$EXEDIR\App\AppNamePortable\folder"
RMDir /r "$folderG"
${Else}
Rename "$folderG" "$EXEDIR\App\AppNamePortable\folder"
${EndIf}
!macroend
${SegmentPostPrimary}
Rename "$EXEDIR\App\AppNamePortable\folder" "$folderG"
!macroend
==========================================================
hope this help.
I haven't looked at the code in a while, but I think you're correct that the left variable can't be a variable.
Sometimes, the impossible can become possible, if you're awesome!
After posting the code here and seeing the answeres I was able to simplify my code to something like these:
Custom.nsh
However, now for some reason the
${AndIf}is not workingThe ${AndIf} part should be:
${AndIf} $0 == "True"
Thank you.