Mantis - Squeak 5.2
Viewing Issue Advanced Details
134 minor always 09-07-04 23:35 09-08-04 19:17
0000134: Windows installer puts user Squeak files under "C:\My Squeak", not under user home directory
I just installed the Windows installer on a Windows 2000 system (both as an administrator and as a power user), and it is putting user files in 'C:\My Squeak\UserName', not in the user's home directory.

This is a problem because in a situation where users share computers (like in schools) they usually are given a home directory for their files, and their files should go there, rather than on the computer they last used.

Why not just put the 'My Squeak' folder somewher under the home directory (that is, under %HOMEPATH%) as expected?

Likewise, global Squeak preferences should be stored under %USERPROFILE%, rather than on the local machine. This would allow the adminstrators of a school network to use a mandatory user profile (which isn't uncommon).

09-07-04 23:54   
The main issue is that we have no way of determining where the current user's home directory is. It is NOT under "My Documents" (this is a pseudo directory) but it lives somewhere under C:\Documents and Settings\UserName\My Documents where -for any international Windows version- everything but the user name will be localized (in a German Windows it would C:\Dokumente und Einstellungen\UserName\Eigene Dokumente). Since there isn't a primitive to retrieve the "home" directory for a user there is no way to guess accurately where the "real" home for a user is.

That said, so far I haven't heard a single complaint about the above choice from "real users". The only issue has been that in a networked environment people wanted to be able to use a networked drive and this can be done by changing Squeak.ini appropriately. The installer will not (and I think should not) help with such cases.
09-08-04 01:00   
Actually, I didn't mean to say 'My Documents', as that's not useful, since it's on boot drive, which is specific to one computer.

However, what *is* useful is to look at the %HOMEPATH%. Which has nothing to do with 'My Documents' and is in fact set to where the user's files should be put in a shared computer setup.

That we don't have a primitive to return the home directory is not exactly correct, since the VM itself comes up with the directories and we can look at those directories. We don't need the home path, just the Squeak home path, which we can get from ioGetUntrustedUserDirectory().

That returns the untrustedUserDirectory
  which is (lowest to highest priority)
    "C:\\My Squeak\\%USERNAME%"
    Security/UserDirectory from Squeak.ini (in same dir as VM by default)
    registry setting of HKEY_CURRENT_USER\SOFTWARE\Squeak\Security\UserDirectory

So just by changing the literal string in the SecurityPlugin from
  "C:\\My Squeak\\%USERNAME%"
to a translated version of
  "%HOMEPATH%\\My Squeak"
or even

this would be fixed to a more sensible setting.

Even without touching the VM, the installer could just set the registry setting for HKEY_CURRENT_USER\SOFTWARE\Squeak\Security\UserDirectory to (a translated version of) "%HOMEPATH%\\My Squeak" or "%HOMEPATH%" (REG_EXPAND_SZ, of course) and get the same effect.

edited on: 09-08-04 01:03
09-08-04 19:17   
An easy way of fixing the problem is to include a Squeak.ini file containing:

UserDirectory=%HOMEDRIVE%%HOMEPATH%\My Squeak