How do I get the user directory?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

How do I get the user directory?

Damien Pollet
aka $HOME or ~/

There is SecurityManager default untrustedUserDirectory
but on my machine this returns
'/Users/damien/Library/Preferences/Squeak/Internet/My Squeak'
and SecurityManager default secureUserDirectory
but this one returns nonsense like  '/foobar/tooBar/forSqueak/bogus'

Besides I have no idea what an untrusted user directory is. Perhaps a
Windowsish concept ?

--
Damien Pollet
type less, do more [ | ] http://people.untyped.org/damien.pollet

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: How do I get the user directory?

johnmci
http://www.smalltalkconsulting.com/html/squeakinfoplist.html

you could set the SqueakTrustedDirectory to ~ in the info.plist

I'm not sure how you would resolve ~ to the user's directory. Any  
takers?

On 3-Sep-09, at 5:14 PM, Damien Pollet wrote:

> aka $HOME or ~/
>
> There is SecurityManager default untrustedUserDirectory
> but on my machine this returns
> '/Users/damien/Library/Preferences/Squeak/Internet/My Squeak'
> and SecurityManager default secureUserDirectory
> but this one returns nonsense like  '/foobar/tooBar/forSqueak/bogus'
>
> Besides I have no idea what an untrusted user directory is. Perhaps a
> Windowsish concept ?
>
> --
> Damien Pollet
> type less, do more [ | ] http://people.untyped.org/damien.pollet
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

--
=
=
=
========================================================================
John M. McIntosh <[hidden email]>   Twitter:  
squeaker68882
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
=
=
=
========================================================================





_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: How do I get the user directory?

Damien Pollet
On Fri, Sep 4, 2009 at 11:02, John M
McIntosh<[hidden email]> wrote:
> you could set the SqueakTrustedDirectory to ~ in the info.plist
>
> I'm not sure how you would resolve ~ to the user's directory. Any
> takers?

I think ~ is a notation from the shell (bash etc) rather than from
posix. I suppose there is a posix call to resolve it though, probably
just reading $HOME from the environment…

--
Damien Pollet
type less, do more [ | ] http://people.untyped.org/damien.pollet

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: How do I get the user directory?

David T. Lewis
On Sun, Sep 06, 2009 at 02:11:01AM +0200, Damien Pollet wrote:

> On Fri, Sep 4, 2009 at 11:02, John M
> McIntosh<[hidden email]> wrote:
> > you could set the SqueakTrustedDirectory to ~ in the info.plist
> >
> > I'm not sure how you would resolve ~ to the user's directory. Any
> > takers?
>
> I think ~ is a notation from the shell (bash etc) rather than from
> posix. I suppose there is a posix call to resolve it though, probably
> just reading $HOME from the environment???

Right, it's just the $HOME environment variable, which is set up when
you log in to the system and inherited by all processes that you run
afterward. There is no direct access to this from Squeak. Using
OSProcess to get the environment, I have this on Linux:

  OSProcess thisOSProcess environment at: 'HOME' ==> '/home/lewis'

And on the same computer running Windows XP, the closest equivalent
seems to be:

  OSProcess thisOSProcess environment at: 'HOMEPATH' ==> '\Documents and Settings\David Lewis'

But I think that the $HOMEPATH convention may vary from one version of
Windows to another (I'm not sure of this), and a Windows user might more
naturally think of '\Documents and Settings\David Lewis\My Documents' as
the "home". There may not really be any "home directory" concept that
would make sense on all platforms.

Dave


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project