My prime directive for the software I write has always been this: Leave everything on the user's system other than my app the #$%^ alone (a task that is difficult when using VB). The Windows registry is something I've kept my hands off, even though it's easy to write to for saving the user's chosen options. Instead, I've always saved such options to a text file named "options.dat."
My system worked fine until someone installed one of my programs while logged in under the administrator's account and then logged off and back in under a limited account and tried to run the program. (If you're curious why, see the PS at the end of this.) In the limited account the user lacked the file permissions needed to write to the useroptions.dat file. I got around this problem via a call to the Windows API that gave me the name of the account in which the user was logged in as, and then creating a separate user options file that he or she had permission to write to. In other words, let's assume the administrator account is named, "Jay" and the limited account is named, "Lisa." When Jay runs the program in his options file is created and named, "Jay_useroptions.dat." Lisa's file would be created under her login and would be named "Lisa_useroptions.dat," which would be a file that she has permission to write to. This new system had the added benefit of letting Jay, Lisa, and anyone else with his own Win XP account save his settings without bothering anyone else's. My questions are about how to port this system to the Mac version of my app: 1. I understand Mac apps don't typically use a setup program that puts the app into a sub-folder under the folder "Program Files" as is done in Windows. Instead, the user simply drags the executable onto the desktop. The useroptions.dat file in my programs has always been kept in the same folder as the executable, and need never be seen or touched by the user. The user clicks a button to save his options and doesn't know how or where these options are kept. In the Mac version which I'm working to port my VB code to, it sounds like useroptions.dat will show up on the Mac desktop. Not good! I could put into the file something such as "Computer generated file -- please do not edit." However, it would still be clutter on the desktop, and some people would probably delete or edit it anyway. Is there some kind of out-of-the-way folder in OS X where programmers can keep files that shouldn't be bothered with? Or is there such a thing as the Mac registry similar to the Windows one that I should? Or should I simply have the app create a folder under the desktop to store the file in? Would that folder then show up on the desktop? 2. Are there user account/file permission issues in OS X similar to the Win XP/2K issues I've described? Do I need to use some kind of call to the Mac API in order to create the separate options files such as Jay_options.dat, Lisa_options.dat, etc? In any event, sorry this was so windbaggyish. (I'm cross posting this to the web-based forum at: http://forums.realsoftware.com/ under the Getting Started category.) cheers, Tom PS: For you curious folks, here's why the user did that: He was protecting his machine from viruses. He only used the administrator's account to install programs, and then did his web surfing in the limited account in which it was impossible to install anything. That way, viruses could not be installed if he encountered any. ********************************************* http://www.renamestar.com Just say NO to VB.NET Try RealBASIC __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com _______________________________________________ Unsubscribe or switch delivery mode: <http://www.realsoftware.com/support/listmanager/> Search the archives of this list here: <http://support.realsoftware.com/listarchives/lists.html>
