Announcement

Collapse
No announcement yet.

INI file placement (again)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • INI file placement (again)

    I figured I'd open a new thread rather than re-open a 3 yr. old one.

    I'm updating a program and have gotten my settings out of the Registry and into standard INI files. I've used Michael Mattias's Move that INI file as a good place to plagiarize the 'where to put it part'.

    Everything's fine except I notice that the chosen directory from %csidl_appdata is a hidden directory. Since the user doesn't have to edit the INI file directly (there's a Preferences dialog) that part is no problem. But the app supports user written Macros which (right now) I expect to find in the appdata file along with the INI.

    Now some users are not going to be bothered by creating files in hidden directories, but there are other users who are going to stumble.

    Anyone else faced this? Am I worrying excessively about my user's capabilities? Or is there some other non-hidden appdata location? Or where else could macro type files go?

    I'm not quite sure why MS makes it hidden anyway.

    George

  • #2
    It's not hidden on my system (Windows/XP SP3) and never has been

    The default "csidl_appdata" is Documents and Settings/<username>/Application data.

    You can't see OTHER user's folders, but that's by design. If you don't need or want a different INI file for each possible user, you can use CSIDL_COMMONAPPDATA... that's Documents and Settings/All USers/Application Data by default.

    Note that these folders are mobile and can be relocated. But I've never seen that done.
    Michael Mattias
    Tal Systems Inc. (retired)
    Racine WI USA
    [email protected]
    http://www.talsystems.com

    Comment


    • #3
      Hi Michael,

      My system is Vista SP1 and I know I didn't make it hidden.

      What are others on Vista seeing? I was only moving this around to avoid the Vista UAC problems of having everything in the Install Directory (Program Files).

      George

      Comment


      • #4
        The directories have widely been changed on Vista, the data folder (CSIDL_APPDATA) is C:\Users\<user>\AppData\Roaming\ and yes, "AppData" is a hidden folder.

        A simple ShellExecute with "explore" verb somewhere in your program (ie: a button in options) should suffice to help your users locate the folder quickly if manual editing is required.
        kgpsoftware.com | Slam DBMS | PrpT Control | Other Downloads | Contact Me

        Comment


        • #5
          > [under Vista] "AppData" is a hidden folder.

          Now *that* is a curious design decision.
          Michael Mattias
          Tal Systems Inc. (retired)
          Racine WI USA
          [email protected]
          http://www.talsystems.com

          Comment


          • #6
            It still eludes me as to where the file would be.

            Who is to say that C: is the drive it is on???
            (Sure its a given, but what if it is not???)

            and to a further point, lets say I can guess my best guess and still not work. From my limited (AKA: NONE) understanding of UAC, then I can upgrade, fix what I need and put the allowances back, so what is to stop a hacker from doing the same???
            Engineer's Motto: If it aint broke take it apart and fix it

            "If at 1st you don't succeed... call it version 1.0"

            "Half of Programming is coding"....."The other 90% is DEBUGGING"

            "Document my code????" .... "WHYYY??? do you think they call it CODE? "

            Comment


            • #7
              Well, its 'nice' (in a way) to know that its not hidden because of some stupidity on my part.

              Kev: I'd already done that. I show the full path of the INI file at the bottom of the Preferences Dialog next to the Done button.

              It still seems mighty stupid for MS to hide a directory needlessly. Just where do they expect users to store application specific, user created files, like macros, templates, etc.? I suppose they want them in Documents. Bah! In that case why isn't AppData itself under Documents? Maybe that's where I'll move it just to get it out of Hidden mode.

              They just have no clue sometimes.

              George

              Comment


              • #8
                The locations to store various data files are all fragmented, have a look at the CSIDL_ range of constants in win32api.inc

                The following MSDN article may also help if you want to know what Microsoft's guidelines are for file/settings storage:

                MSDN: Data and Settings Management

                PS. The article is Windows 2000-specific but it also applies to XP, Vista et al.
                kgpsoftware.com | Slam DBMS | PrpT Control | Other Downloads | Contact Me

                Comment


                • #9
                  Originally posted by Michael Mattias View Post
                  It's not hidden on my system (Windows/XP SP3) and never has been

                  The default "csidl_appdata" is Documents and Settings/<username>/Application data.
                  Application data - on a standard Windows installation - is a hidden folder since Windows 2000. Just like Local Settings is a hidden folder per default

                  And yes - it *is* a curios, given the fact that the TEMP folder is located under Local Settings. And we all know this one needs a cleaning from time to time.

                  Have you set up your box yourself, Michael?

                  Comment


                  • #10
                    Vista also has the global C:\ProgramData folder which is also hidden.
                    Scott Slater
                    Summit Computer Networks, Inc.
                    www.summitcn.com

                    Comment


                    • #11
                      This may be a done topic, but I have Windows 2000, XP, and Vista on different machines here, and CSIDL_APPDATA is hidden on all three. Default visiblity in Explorer can be changed under the equivalent of Tools > Folder Options > "View" Tab. The third-party file manager I use can show the hidden files/folders independent of the system default state, but shows them in a ghostly way so you can tell they're hidden.

                      I wouldn't swear to this, but IIRC shouldn't user script files really go under the CSIDL_MYDOCUMENTS if the user needs to touch them? I think CSIDL_APPDATA is for data the app manages transparently. I think what's considered polite is to ask the user during installation, and default to CSIDL_MYDOCUMENTS\AppName\, and also make it a setting.

                      For "portable" installations, I think it's okay to force a particular folder structure, but that it should be beneath the the application's exe folder and determined dynamically each time it is needed. There's a guide out there somewhere about all the considerations for portable apps and it covers things like that, such as making sure you're not dependent on the drive letter and base directory, and things like that. But since writing to the application directory is technically a no-no for traditional installed applications, you almost have to determine upon installation whether the user wants the application to be portable or fixed.
                      Troy King
                      katravax at yahoo dot com

                      Comment


                      • #12
                        Troy: What I do for portability is to examine the EXE.Path$ and see if the drive is removeable. If it is, I swap the default location for INI files etc. to the EXE path rather than use AppData or Documents. Seems to handle it fairly logically (IMHO).

                        George

                        Comment


                        • #13
                          George: how do you check "if the drive is removeable"?.
                          It look simple but I don't know. Thks.

                          Comment


                          • #14
                            See the Windows API function GetDriveType.

                            Comment


                            • #15
                              OK, thanks Konrad.

                              Comment


                              • #16
                                "Knuth" or "Mr. Konrad" ... I prefer the former

                                Comment


                                • #17
                                  revised version:

                                  Thanks, Knuth

                                  Comment


                                  • #18
                                    Somewhere in the past (in the Source code forums) I know that "Me, MySelf, and I" as well others have posted code that gets your folder (Where am I?? where are my children?? Where is my INI??? as well as "Its 10PM do you know where your kids are??? ) and stuff like if it is a local drive? a partition? or a removable drive?


                                    I find it hard to find that it has not been done (as I have seen it before) but I think the key is the correct search words (kinda ironic, I can not even find my own posts, nor the ones I KNOW I have seen somewhere but memory is "Application Specific")

                                    Engineer's Motto: If it aint broke take it apart and fix it

                                    "If at 1st you don't succeed... call it version 1.0"

                                    "Half of Programming is coding"....."The other 90% is DEBUGGING"

                                    "Document my code????" .... "WHYYY??? do you think they call it CODE? "

                                    Comment

                                    Working...
                                    X