You are here

Specify different configuration file at run-time

4 posts / 0 new
Last post
Last seen: 3 years 1 month ago
Joined: 2007-07-20 02:55
Specify different configuration file at run-time

I was wondering if there's any way of specifying which .ini file to use at runtime.
I have installed Google Chrome Portable and I'm trying to create different data profile folders for different users who will all use Chrome but not at the same time.
The solution would be to create a shortcut to the launcher for each user which would use a different .ini every time. The problem is that the launcher always uses GoogleChromePortable.ini

Is there any way to override this at run-time, without having to recompile the launcher or without having to install the whole application in separate folders?

And if there isn't such a way, can I recompile the launcher to use a configuration file with the same name as the launcher? For example, if I create GoogleChromePortable2.exe and GoogleChromePortable3.exe, could these somehow read at runtime GoogleChromePortable2.ini and GoogleChromePortable3.ini respectively?

[Duplicate comment removed by mod JTH]

Chris Morgan
Chris Morgan's picture
Last seen: 8 years 3 months ago
Joined: 2007-04-15 21:08
Short answer:


I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

Last seen: 3 years 1 month ago
Joined: 2007-07-20 02:55
Well, it can be done

FWIW, here's what I did:
1) Edit GoogleChromePortable.nsi
2) Put Var exename in the Variable section
3) In function ReadINI, put at the beginning StrCpy $exename $EXEFILE -4 and replace inside the same function every occurence of ${NAME}.ini with $exename.ini
4) Recompile

Now, the launcher tries to read a configuration file with the same name as itself, so I could copy GoogleChromePortable.exe and rename the copies like GoogleChromePortable_billy.exe, GoogleChromePortable_john.exe and they would use GoogleChromePortable_billy.ini and GoogleChromePortable_john.ini respectively Smile

Can this be made somewhat official? I don't see any disadvantage off the top of my head.

John T. Haller
John T. Haller's picture
Last seen: 2 hours 45 min ago
Joined: 2005-11-28 22:21

That's a lot of added complexity for not much gain. And it won't work with the platform or anything else that people normally use to launch their apps.

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

Log in or register to post comments