I guess this question has been asked a number of times, but I would like some clarification on the subject. To talk by example, I will use a portable launcher I have created for msysgit.
[Environment]
HOME=%PAL:DataDir%\home
PATH=%PAL:AppDir%\PortableGit\cmd;%PATH%
[Launch]
ProgramExecutable=PortableGit\git-cmd.bat
ProgramExecutableWhenParameters=PortableGit\cmd\git.cmd
SingleAppInstance=false
DirectoryMoveOK=yes
HideCommandLineWindow=true
[FileWrite1]
Type=Replace
File=%PAL:DataDir%\home\.gitconfig
Find=%PAL:LastDrive%%PAL:LastPackagePartialDir%
Replace=%PAL:Drive%%PAL:PackagePartialDir%
[FileWrite2]
Type=Replace
File=%PAL:DataDir%\home\.gitconfig
Find=%PAL:LastDrive%/
Replace=%PAL:Drive%/
Using this launcher, I get the following:
- Using the Environment, I am properly setting the git HOME folder to where it should be
- I use the FileWrites to update any paths inside the .gitconfig file
- I am using the git-cmd for standalone use - thus, I am getting a ready-to-use command line interface - and the git.cmd when invoking the launcher with parameters - for git related automations
Everything is working like a charm. My question is how do I provide the same functionality for the git bash shell.
From what I've been reading, I have to create a second launcher for that one. My main question is: Will both launchers work at the same time without messing up the data? Meaning, can I have MSysGitPortableBash.exe and MSysGitPortableBash.exe running at the same time?
To get more insight, what are the answers to the following questions:
- If I have two different launchers for the same app running at the same time, what happens with the FileWrite sections? Will both launchers update the files?
- What happens for more complicated apps - for instance, apps that write to the registry and move files and/or folders?
- Can I use the same appid in two launchers? And if so, will that resolve any issues related to the previous questions?
Thanx in advance for any insight.
PAL doesn't support multiple launchers exactly but you can sorta get around it by having two launcher INIs and modifying the appinfo.ini file to reflect the details of one launcher and then compile it then modify the appinfo again and compile the other launcher.
To fix the issue with writing to the files, the only workaround I can think of is to have each launcher detect if the other is running first. You can do this easily by adding [Launch]:CloseEXE=MSysGitPortableBash.exe to the MSysGitPortableLauncher.ini and the opposite for the other launcher.
Have a look at how I setup the launchers for AutoHotkey_L: https://portableapps.com/node/32170
I have two appinfo.ini files, which I use to generate two independent launchers. I actually have 4 launchers for that app, but 2 of them didn't need any fancy stuff done for them, so I just used a compiled AutoHotkey script to launch them.
Also, I've created a portable version of msysgit for myself but haven't published it yet. If you want to discuss implementation methods, let me know. It would be nice to get an updated version of msysgit published.