INI Look Up Logic: Program Folder First?

English support forum

Moderators: Hacker, petermad, Stefan2, white

User avatar
kwanbis
Junior Member
Junior Member
Posts: 68
Joined: 2006-11-06, 21:30 UTC

INI Look Up Logic: Program Folder First?

Post by *kwanbis »

I have edited the request to be like this.

When TC starts up, it should do:

Is there an INI location on ther current user Registry?
Yes? Load from there.
No? Is there an INI in Documents and Settings for current user?
Yes? Load from there.
No? Is there an INI in Application Data for current user?
Yes? Load from there.
No? Is there an INI in Program Directory (systemwide)?
Yes? Load from there.
No? Is there an INI in Windows Directory (systemwide)?
Yes? Load from there.
No? Ask user where he wants the INI.

I think is the best way to do it.
Last edited by kwanbis on 2010-06-23, 19:14 UTC, edited 1 time in total.
User avatar
Vochomurka
Power Member
Power Member
Posts: 816
Joined: 2005-09-14, 22:19 UTC
Location: Russia
Contact:

Post by *Vochomurka »

It is inportant when there are many configuration files on your computer. If so, the sequence to load them is critical. Why have many wincmd.ini files? If you want to load different ini's, use the /i= command line parameter, and perhaps different shortcuts (for example, various users, various plugin sets, colors, etc). Actually, one of them named exactly wincmd.ini, and placed in one of the listed places, is considered as a "main" configuration.
If you want to start TC with diffferent wincmd.ini's stored in different dirs, you can create different shortcuts with such keys:

Code: Select all

/i=<environment_variable>\wincmd.ini
For example,

Code: Select all

/i=%SystemRoot%\wincmd.ini
So, your application would be portable and independent of the directory where TC is installed. TC loader reads the indicated wincmd.ini, finds the InstallDir key, and finally starts TC from that folder.
Single user license #329241
PowerPro scripts for Total Commander
User avatar
kwanbis
Junior Member
Junior Member
Posts: 68
Joined: 2006-11-06, 21:30 UTC

Post by *kwanbis »

I'm not talking about having different INI files.

I'm talking about the logic that TC should use when searching for INI files.

As it is today, TC relies on a registry setting (HKEY_CURRENT_USER\Software\Ghisler\Total Commander) , to check the INI location, when it should not need to IMHO.

When starting up, TC should check for INI file like this:

1) Program Directory
2) Windows Directory
3) Documents and Settings (user specific)
4) Application Data (user specific)
5) User Defined (store on Program Dir a INI with only a value of IniDir= x:\user\defined\folder\ini

So there is no need for any REGISTRY setting to look at.
User avatar
HolgerK
Power Member
Power Member
Posts: 5412
Joined: 2006-01-26, 22:15 UTC
Location: Europe, Aachen

Post by *HolgerK »

Now, can it be made that TC looks FIRST on the Program Directory?
Add UseIniInProgramDir=7 to your wincmd.ini
Help,4.5 Ini-File settings: [u]wincmd.ini[/u] wrote:This variable will only be read if the wincmd.ini is located in the same dir as the program. It must be put in wincmd.ini directly, RedirectSection has no effect on this variable.
It is the sum of the following values:
1: Use wincmd.ini in program dir if no other location is set via registry or parameters
2: Use wcx_ftp.ini in program dir if no other location is set via registry or parameters
4: Override registry settings (but not command line parameters)
HTH
Holger
User avatar
kwanbis
Junior Member
Junior Member
Posts: 68
Joined: 2006-11-06, 21:30 UTC

Post by *kwanbis »

Ah, excellent! Wonder why this is not a default.

Would that mean i can delete the:
InstallDir=c:\totalcmd

From the INI?
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

kwanbis wrote:Ah, excellent! Wonder why this is not a default.
Because many many years ago programs kept INI files in Windows directory, so first search place was left unchanged for backward compatibility. But now in moders OS (BTW in XP too if you're not admin) user have no write permissions to program directory, only to user application data folder. But if you want to keep INI in program dir, you should use mentioned UseIniInProgramDir=7 parameter.
User avatar
kwanbis
Junior Member
Junior Member
Posts: 68
Joined: 2006-11-06, 21:30 UTC

Post by *kwanbis »

Right, this is why my idea is best:

1) Check "Program Directory" is it there? Perfect! Use it.
2) Check "Windows Directory" is it there? Perfect! Use it.
3) Check "Documents and Settings" is it there? Perfect! Use it.
4) Check "Application Data" is it there? Perfect! Use it.
5) User Defined (store on Program Dir a INI with only a value of IniDir= x:\user\defined\folder\ini

This way, you cover all the bases, and you need no registry.
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Now lets think...

One user installed TC to C:\TOTALCMD and made choice to keep INI-file in program dir. Second user installed TC into same dir (why not?) and chose to keep INI in its appdata dir. Third user (why not?) installed TC into same dir and wanted to keep INI in some other dir (this path is stored into registry)...

Now lets apply your logic. According to your logic all users will have TC using same INI in program dir... :wink:

That's why program dir has lowest priority which you can easily override by specifying parameter UseIniInProgramDir (in this case TC will use this INI always except cases when INI is passed using /i= command line parameter).
User avatar
kwanbis
Junior Member
Junior Member
Posts: 68
Joined: 2006-11-06, 21:30 UTC

Post by *kwanbis »

So, you mean that 3 different user buy 3 different copies of TC, and all install all on the same PC? I bet that 99.999% of the users of TC do not install on the same place as another user.

Anyway, if 3 users are going to install TC on the same computer, they have 2 options:

1) Install in TC1, TC2, and TC3, folders, cause if not, the registration information gets overridden.

2) Install on TC folder, but chose user folder, because of the registration information.

So, my logic would work:

Option (1)
Is INI on program folder? Yes
Load from there.

Option (2)
Is INI on program folder? No
Is INI on Windows folder? No
Is INI on users data folder? Yes.
Load from there.

Still much simpler.
Last edited by kwanbis on 2010-06-23, 04:03 UTC, edited 1 time in total.
Sob
Power Member
Power Member
Posts: 945
Joined: 2005-01-19, 17:33 UTC

Post by *Sob »

Let me introduce you to the wonderful new world of multiuser operating systems. Available in Windows universe for only around fifteen years now. ;) One computer, many user profiles. Applications in shared location, settings in user folders, because every user has a different taste. That's the right way of doing things. Settings in program folder are just remains from the past.
It may not look so great when you have the computer only for yourself, but hey, you have the choice and if you want your settings in program folder, you can have them there. Really, what's to complain about? :)
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

kwanbis wrote:So, you mean that 3 different user buy 3 different copies of TC, and all install all on the same PC? (I bet that 99.99% of the users of TC do not install on the same place as another user.)
Why not? If there are 3 accounts on PC, and all three users using TC, why they must install TC into different places and waste disk space? Maybe they must install three Windows copies too?
Every user may have its own configuration, set of plugins etc, so there is no problem in installing TC to same dir.
1) Install in TC1, TC2, and TC3, folders, cause if not, the registration information gets overridden.

2) Install on TC folder, but chose user folder, because of the registration information.
There is an INI key KeyPath that allows to specify path to key file so it's not a problem at all. Every user can install TC into any dir with any settings and it won't intercept with any settings of any other user.
User avatar
kwanbis
Junior Member
Junior Member
Posts: 68
Joined: 2006-11-06, 21:30 UTC

Post by *kwanbis »

1) Install in TC1, TC2, and TC3, folders, cause if not, the registration information gets overridden.

2) Install on TC folder, but chose user folder, because of the registration information.
MVV wrote:Why not? If there are 3 accounts on PC, and all three users using TC, why they must install TC into different places and waste disk space? Maybe they must install three Windows copies too?
Every user may have its own configuration, set of plugins etc, so there is no problem in installing TC to same dir.

There is an INI key KeyPath that allows to specify path to key file so it's not a problem at all. Every user can install TC into any dir with any settings and it won't intercept with any settings of any other user.
So, you are saying:

2) Install on TC folder, but chose user folder, because of the registration information.

Again, my logic works.
User avatar
kwanbis
Junior Member
Junior Member
Posts: 68
Joined: 2006-11-06, 21:30 UTC

Post by *kwanbis »

Sob wrote:Let me introduce you to the wonderful new world of multiuser operating systems. Available in Windows universe for only around fifteen years now. ;) One computer, many user profiles. Applications in shared location, settings in user folders, because every user has a different taste. That's the right way of doing things. Settings in program folder are just remains from the past. It may not look so great when you have the computer only for yourself, but hey, you have the choice and if you want your settings in program folder, you can have them there. Really, what's to complain about? :)
So you are saying:

Install on Program Files folder, but use USER DATA folder.

My logic still works.
MVV wrote:Why not? If there are 3 accounts on PC, and all three users using TC, why they must install TC into different places and waste disk space? Maybe they must install three Windows copies too? Every user may have its own configuration, set of plugins etc, so there is no problem in installing TC to same dir. There is an INI key KeyPath that allows to specify path to key file so it's not a problem at all. Every user can install TC into any dir with any settings and it won't intercept with any settings of any other user.
You are also saying:

Install on Program Files folder, but use USER DATA folder.

Again, my logic still works.

And don't tell me one user would install on the Program Files folder, and the other 2 in the data folder.

In that case, TC could be made to check:

1) Documents and Settings (user specific)
2) Application Data (user specific)
3) Program Directory
4) Windows Directory
5) User Defined.

And no need for registry.
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

If you have no registry settings, TC will keep configuration files in Documents and Settings (user specific) folder. There is no need for registry, it was made for convenience - using registry entries every user can specify any path to configuraiton files.
And don't tell me one user would install on the Program Files folder, and the other 2 in the data folder.
Why not? One user wishes to have wimcmd.ini in TC dir for easier access, another user just installs TC so TC will place wincmd.ini into user profile etc...

TC logic is the same for years, plugin writers and other people know it and use it. There is no need to change it because there is no ideal idea for all users.
User avatar
kwanbis
Junior Member
Junior Member
Posts: 68
Joined: 2006-11-06, 21:30 UTC

Post by *kwanbis »

Because i'm sure the situation you propose has less than 0.000000001 possibility of happening.

It just feels like you need to "defend TC's way", without even understanding the options i have given.

My logic covers all the same possibilities, and it uses no registry. Apparently you do not understand how it works.

I propose you to give "realistic" options, and i would show you how it works with my proposal, which by the way is very simple.

And do not worry, i LOVE TC, just feel there are some things that can be improved.
Post Reply