You are here

Specify different configuration file at run-time

4 posts / 0 new
Last post
Wizard
Offline
Last seen: 7 months 4 weeks ago
Joined: 2007-07-20 02:55
Specify different configuration file at run-time

Hi!
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
Offline
Last seen: 9 years 5 months ago
Joined: 2007-04-15 21:08
Short answer:

No.

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

Wizard
Offline
Last seen: 7 months 4 weeks 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
Offline
Last seen: 7 hours 6 min ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Nope

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