topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Friday December 13, 2024, 12:04 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Experimental Alpha Version with ConfigDir.ini - Choose Where to Store Settings  (Read 6339 times)

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
I'd like to have some help testing a new feature i'd like to add to all of my programs, the ability to specify where you want your settings .ini file stored.

This has been requested by several people in the past, and it's a strange enough change that i would really appreciate some multi-day testing by people who use the program.

By default my programs store their settings in the program directory itself, which is good for portability like running it on usb drives, but bad for running it off cd rom for example, and bad for people who like all data settings stored in separate directories.

Ok so here is the alpha version (v2.23.01):
https://www.donation...ScreenshotCaptor.exe

Install it as normal over the old version.  By default it *should* behave exactly as before.
However you will notice a file ConfigDir.ini in the program directory.
Opening that with a text editor will reveal the following:


Code: C++ [Select]
  1. CONFIGDIR = .
  2.  
  3. // This file (ConfigDir.ini) defines the directory where all configuration
  4. //  files for the program will be stored.
  5. // There should be only 1 actual line in this file that has any meaning,
  6. //  the CONFIGDIR assignmane above.  Everything else here is just comments.
  7. //
  8. // By default it is normally set to the program directory itself, meaning
  9. //  that all configuration/ini/settings/preferences will be store here
  10. //  with this ConfigDir.ini file.  This is also best for when you want to
  11. //  put the program on a usb drive.
  12. // Sometimes it is preferable to store the configuration files in a
  13. //  different directory, like a "C:\Documents and Settings" subdirectory
  14. //  which is designed to store program configuration data, or a custom
  15. //  directory specified by a user on a separate drive.
  16. //
  17. // TIPS:
  18. // 1. You can comment out lines by prefacing them with //
  19. // 2. You can use the following replacements:
  20. //     . (actual program directory)
  21. //     %MYDOCUMENTS% (like C:\My Documents)
  22. //     %APPDATA% (like C:\Documents and Settings\{username}\Application Data)
  23. //     %PROFILE% (like C:\Documents and Settings\{username})
  24. //     %COMMONAPPDATA% (like C:\Documents and Settings\All Users\Application Data)
  25. // 3. The specified directory will be created if it doesn't exist.
  26. // 4. If configuration files are not found in the specified directory,
  27. //     any existing configuration files in the app dir will be copied
  28. //     from the app dir to the specified directory.
  29. // 5. If you edit this file while the program is running you need to
  30. //     exit and restart the program before it will take effect.
  31. //
  32. // EXAMPLES:
  33. //    CONFIGDIR=.
  34. //    CONFIGDIR=%MYDOCUMENTS%
  35. //    CONFIGDIR=E:\MyCleverSettings\
  36. //    CONFIGDIR=%APPDATA%
  37. //
  38. // NOTE: the company and application subdirectory name will automatically be
  39. //  added to the path specified (except for %APPDIR% which includes the name
  40. //  already, i.e.:
  41. //    "E:\MyCleverSettings" -> "E:\MyCleverSettings\DonationCoder\AppName\"
  42. //
  43. /////////////////////////////////////////////////////////////////////////////

So basically you just change that top line in that file to redirect the config file to be saved elsewhere, and then restart the program.

Important Note 1: On first use of a new location it will copy your old settings into the new location.
Important Note 2: You will probably have to go to options -> Folders and change your ScreenShots directory which will be hardcoded to the application directory (just change it to 'Screenshots' without any path, or elsewhere, it's up to you).
Important Note 3: There is no way to change this file from within the program, you must edit it yourself using a text editor like notepad.



Thanks for helping me test - i appreciate any reports (and suggestions).
I think eventually i will make it possible to change the dir from within options.

Once we get this working well i will add it to all of my programs

NeilS

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 78
    • View Profile
    • Donate to Member
Hey Mouser,

Great new feature - think this will make quite a few people happy.

It seems to be working fine for me so far, with the exception that %MYDOCUMENTS% doesn't get expanded, so I just get a folder in the program directory called "%MYDOCUMENTS%". The others (%APPDATA%, etc. and explicit paths) work fine though.

Not sure if this is relevant, but I've got my "My Documents" folder in a custom location - however, the registry (at HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Personal) does point to it.

I also noticed that the filter type (under smoothing) wasn't getting saved into the ini. That just happened to be the first setting I changed when testing to see if changes were recorded in the correct ini file. I thought it wasn't working at all at first, until I tried changing different settings, and they were recorded in the correct ini file, so I think it's just an omission of that particular setting and not an issue with the new ini scheme. (BTW, it would be nice to have that fixed at some point - I'm not a massive fan of the FastLinear filter :))

HTH,

- Neil.

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
thanks so much neil -
new version uploaded (same url) which should fix the two problems you pointed out.

NeilS

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 78
    • View Profile
    • Donate to Member
Both working as expected now. :)

One other thought... At the moment, when you change the config dir, I'm assuming it just copies the INIs from the program dir to the specified config dir (unless there's something there already). When you add support to change the config from within the app, are you planning to copy/move the files from the last used dir to the new position?

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
thats a good question, right now it won't copy from LAST USED directory, but always from install directory to new idrectory..

NeilS

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 78
    • View Profile
    • Donate to Member
Is it just old age creeping up on me, or did ESC do a "Discard Image" on the popup dialog on previous versions? If it did used to do it, it doesn't seem to be working in this version.

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
it did - did it dissapear? ill check into it.