You are here

Modifying a special configuration file

5 posts / 0 new
Last post
tapsklaps
Offline
Last seen: 5 years 5 months ago
Developer
Joined: 2010-10-17 08:11
Modifying a special configuration file

Assuming we have a configuration file as follows:

[username1]
.
.
Path=X:\folder1\folder2\folder3
.
.

Here is "username1" the name of the logged user on the host PC. If I now insert the USB flash drive on another PC, where "username2" is the name of the logged user, then the above configuration file are changes as follows:

[username1]
.
.
Path=X:\folder1\folder2\folder3
.
.
[username2]
.
.
Path=Y:\folder4\folder5\folder6
.
.

The problem now is that I usually don't know the specific name of the logged user, if I insert the USB flash drive on a new host PC. Therefore it seems to be impossible, that I can modify the above mentioned configuration file with [FileWriteN].

Has anyone an idea to solve this problem?

depp.jones
Offline
Last seen: 1 day 23 hours ago
DeveloperTranslator
Joined: 2010-06-05 17:19
I think, there is no simple

I think, there is no simple solution for that as it also affects the files created (User dictionaries and output paths in TomahawkPDF+ Portable). It is kind of a mess and I think you could either leave it untouched or write some rather complicated custom code (you have to store the last user name somewhere, read the current user and replace all entries in Spell.cfg, merge the Dictionaries, rename the folder etc.).

Gord Caswell
Gord Caswell's picture
Offline
Last seen: 4 months 1 week ago
DeveloperModerator
Joined: 2008-07-24 18:46
Shouldn't be too hard

It shouldn't be too hard, after all. I'm currently checking the MSDN for the right function.

All that's needed is:

Save the last-used username in %APPNAME%PortableSettings.INI
Compare last username with current username and do a find/replace in the appropriate files.

Can you give a more specific description of what application you're trying to do this with?

tapsklaps
Offline
Last seen: 5 years 5 months ago
Developer
Joined: 2010-10-17 08:11
Tomahawk PDF+

I detect this problem in conjunction with my portable app "Tomahawk PDF+ Portable". There will be created a file named "Spell.cfg", which have this characteristic.

depp.jones
Offline
Last seen: 1 day 23 hours ago
DeveloperTranslator
Joined: 2010-06-05 17:19
Oh, I think, I misread your

Oh, I think, I misread your post, sorry.
Now I can only guess that you are trying to nail down a user selected dictionary location so forget the part of my previous post regarding the user dictionaries and folders... Wink
SOmetimes it is better to give specific information than some general construct.

Log in or register to post comments