Hello,
I need to modify a file of a program called 'profile' which is located in '\AppPortable\App\AppName\folder'.
In order to avoid that my modified 'profile' is being overwritten by the original one I added the following to my installer.ini:
[FilesToPreserve]
PreserveFile1=App\AppName\folder\profile
I want to create an online installer which downloads the source code and extracts it to \App\AppName:
AdvancedExtract1To=App\AppName
AdvancedExtract1Filter=*
So, how can I avoid that the modified 'profile' file which I put in \App\AppName\folder gets overwritten during the installation?
Preserve is intended to preserve a file in a directory that would otherwise be wiped out. For example, the whole App directory is normally wiped (unless you set an option for it not to be) and it give you the ability to preserve one or more files within it.
It does not prevent a file that is also in your installer from overwriting one that is already there. Everything in the installer should be installed regardless of preserved bits.
If profile contains anything you wish to save between sessions, it should likely be moved back and forth to Data. Remember, App is for the app only, no settings, etc.
Sometimes, the impossible can become possible, if you're awesome!
Thank you. 'profile' is a app-relevant file and needed for the app to run. However, the modification is necessary to make it portable.
So, the right way is to add something like the following to launcher.ini?
[FilesMove]
profile=%PAL:AppDir%\AppName\folder
Will this move my modified file to App\AppName\folder?
Do I have to place my modified 'profile' in 'DefaultData' when creating the installer?
That is the way it would work. But why does it need to have anything done to it post-install? Why not just have it set up for portable use within App before you package the installer and be done with it?
Sometimes, the impossible can become possible, if you're awesome!
Because it is an online installer. Thus I cannot modify it before packaging.
But your solution worked out nicely. Thank you!
You could also write the file specifically as part of the installer using custom code. That would eliminate the need for a move operation.
Sometimes, the impossible can become possible, if you're awesome!
Can you provide me more information or a documentation on how to do this?
The development section includes the PortableApps.com Launcher manual with info on how to write to a file using PAL if you want to do it in the launcher.
To do it in the installer, you could have a copy of the correct file at App\bin\profile that you can copy over at the end of running the installer. You'd have custom code in a PortableApps.comInstallerCustom.nsh file within Other\Source. Something like:
That would delete the profile folder that was extracted from the online installer bit and copy in the proper one at the end of the installer.
Sometimes, the impossible can become possible, if you're awesome!
Good idea but what about the $INSTDIR\App\bin folder after the copy process? Will this directory be automatically deleted since it is not required?
Or wouldn't it be better to store profile in Other\Source, too?
App\bin is fine and will be ignored from then on. You could name it App\misc if you want as that would be more appropriate. Other\Source is only for source code and associated bits.
Sometimes, the impossible can become possible, if you're awesome!
Thanks John. I like that solutions and will test it asap.