You are here

Move file and folder in the right 32/64 bit application folder

11 posts / 0 new
Last post
Pico1965
Offline
Last seen: 9 months 2 weeks ago
Joined: 2006-06-06 12:08
Move file and folder in the right 32/64 bit application folder

I try to portabilize an app developement in 32 & 64bit architecture.

The versions of program are stored in:
%PAL:AppDir%\program32
%PAL:AppDir%\program64

In %PAL:DataDir% there's a folder:
SETUP
and a file
program.ini.

Execute the right version of the program is simply:
[Launch]
ProgramExecutable64=program64\program.exe
ProgramExecutable=program\program.exe

My goal is move the folder SETUP and the program.ini file in the folder content the right 32/64 version of program.

I've created a custom.nsh file put in %PAL:AppDir%\AppInfo\Launcher folder:

${SegmentFile}

${SegmentInit}
${If} $Bits = 64
${SetEnvironmentVariablesPath} FullAppDir $EXEDIR\App\program64
${Else}
${SetEnvironmentVariablesPath} FullAppDir $EXEDIR\App\program
${EndIf}
!macroend

It's not flour on my sack.
I found it somewhere and tried to adapt it to my needs.
If I did not understand, create the FullAppDir variable containing the path I need

Then
[FilesMove]
program.ini=%FullAppDir%
[DirectoriesMove]
SETUP=%FullAppDir%

But not working...

A little bit of help will be appreciated

JLim
Offline
Last seen: 2 weeks 5 days ago
Joined: 2013-07-17 01:30
Your DirectoriesMove is not correct.

Your DirectoriesMove is not correct. Should be:
[DirectoriesMove]
SETUP=%FullAppDir%\SETUP

Pico1965
Offline
Last seen: 9 months 2 weeks ago
Joined: 2006-06-06 12:08
Thank you for your interest

Thank you for your interest

With the change suggested by you the situation is as follows:

http://pikky.net/Dny

A folder %FullAppData% was created in %PAL:AppDir%.

IMHO
Something does not go in custom.nsh or I put it in a wrong folder

JLim
Offline
Last seen: 2 weeks 5 days ago
Joined: 2013-07-17 01:30
The picture showed that

The picture showed that %FullAppData% is not defind.
Add the following to the custom code see will it solve the problem. The code is taken from the official 7 zip portble.

${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

Pico1965
Offline
Last seen: 9 months 2 weeks ago
Joined: 2006-06-06 12:08
Thanks. Work fine!

Thanks.

Work fine!

richo
richo's picture
Offline
Last seen: 3 weeks 4 days ago
Joined: 2007-01-31 22:03
Better way

Add the following to your .ini in App\AppInfo\Launcher:

[Environment]
FullAppDir=%PAL:AppDir%\program

And then you should be able to have your custom.nsh as the following:

${SegmentFile}

${SegmentPrePrimary}
  ${If} $Bits = 64
    ${SetEnvironmentVariablesPath} FullAppDir $AppDirectory\program64
  ${Else}
    ${SetEnvironmentVariablesPath} FullAppDir $AppDirectory\program
  ${EndIf}
!macroend
3D1T0R
3D1T0R's picture
Offline
Last seen: 2 years 8 months ago
Developer
Joined: 2006-12-29 23:48
pointless redundancy

If you set the environment variable in custom code, why also set it in the [Environment] section?

~3D1T0R

Gord Caswell
Gord Caswell's picture
Offline
Last seen: 4 months 1 week ago
DeveloperModerator
Joined: 2008-07-24 18:46
Environment won't work

On top of that, the Environment section would only set FullAppDir for x86, rather than for both x86 and x64.

JLim
Offline
Last seen: 2 weeks 5 days ago
Joined: 2013-07-17 01:30
@Gord Caswell,

@Gord Caswell,
It is seems that the build-in $Bits variable in PAL not work.

Gord Caswell
Gord Caswell's picture
Offline
Last seen: 4 months 1 week ago
DeveloperModerator
Joined: 2008-07-24 18:46
$Bits working

I just did a test using 7-zip (removing the custom $Bits setting, since that's been included by default since PAL 2.1), and the $Bits variable is working perfectly.

John T. Haller
John T. Haller's picture
Offline
Last seen: 4 hours 41 min ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Some Posts Removed

Some posts that fan afoul of the PortableApps.com Forum Guidelines' "Play Nice" rule have been removed. We apologize for the interruption. Please continue portable app-ing.

Sometimes, the impossible can become possible, if you're awesome!

Log in or register to post comments