Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: system/options/home on Windows /Core 2.5.6

From: brian:hawley at: 15-Aug-2003 13:53

At 01:47 PM 8/12/03 -0700, [carl--rebol--com] wrote:
>System/options/home is set according to the first of these >that succeeds: > >1. Windows registry (in view, link) >2. HOME envr variable >3. Current directory at boot (but may be different than exe dir) > >Linux/Unix systems often set HOME to the home dir of the user, >so multi-user systems will work fine with a single REBOL exe. >Each user can have their own user.r files.
Sounds great! With Windows, things are clearly not that simple. When Windows is set up as a multi-user system (all the time on the NT platform, optional on 9x) the equivalent to HOME is the user profile directory. NT generates an automatic environment variable USERPROFILE to get at this directory; 9x doesn't make it that easy. Applications like REBOL usually store their data in an app-specific subdirectory of "Application Data", a place accessible on all versions of Windows. This directory can be discovered in the registry value "AppData" in the key: HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders On NT this value is also accessible from the environment in the variable APPDATA. Looking all that up on every REBOL startup seems a bit much. If you would change startup at all, I would suggest that you have the environment lookup for the user home directory (to put in system/user/home) check for USERPROFILE if the check for HOME fails. That's what many other programs that use Unix- like settings on Windows do, such as Java and the GIMP. The View install should definitely put its data in the %AppData%\REBOL\View directory by default though - but use the registry value for portability. The only trick is to remember to install only one copy of the View exe in some central directory (like C:\Program Files\REBOL\View) for file association purposes, separate from the user's data, and make the Add/Remove Programs uninstaller deal only with the program and associations. The uninstaller in the View interface should just remove the user settings in the registry, leaving the global settings alone. That's how I'd do it anyway. And will for you if you send me a copy of the installer code - I've some free time but no SDK to check myself for said code. I'd be willing to follow the SDK license restrictions on such code if you like, so there should be no worries for you. Just offering.
>However, perhaps the problem would be that REBOL.r also uses >the same paths, where it might be good to add a check for it in the >exe directory first. Which the user may not be able to write, thus you >can force specific startup for all REBOL users. > >Is that what you are suggesting?
Basically, yes. On Unix there are global settings directories that can be used for such purposes, but on Windows these global settings are generally in the program directory, the Common AppData directory, the WINDOWS directory or the registry. The program directory seems to be the most workable for REBOL in a cross-platform way. By the way, this is what I meant when I did that huge feedback about Windows logo compliance back on 20-Sep-2000, #4412 at the time.
Thanks for the answer, Carl! Brian Hawley