Lisp HUG Maillist Archive

OSX users/pathnames

Hi,

I have an application that will be used by multiple user accounts in 
OSX.  I would like each user to have a unique preference file stored 
somewhere in their user directory.  However, to access this file, I 
need some way of knowing which user is currently logged in (or better, 
a pathname to the /Users/current_username directory).  Since the 
application itself is stored only once on the hard drive, I can't see 
any way of getting at this through current-pathname.  Of course I could 
prompt the user to locate their preference file, but I would much 
prefer this to be loaded automatically. Any ideas?

Thanks,

-Chris Sims


OSX users/pathnames

Try
(parse-namestring "~/preference-file")

(as "~" will get you the home directory)


On Tue, 4 Jan 2005 12:50:19 -0500, Chris R. Sims <simsc@rpi.edu> wrote:
> Hi,
>
> I have an application that will be used by multiple user accounts in
> OSX.  I would like each user to have a unique preference file stored
> somewhere in their user directory.  However, to access this file, I
> need some way of knowing which user is currently logged in (or better,
> a pathname to the /Users/current_username directory).  Since the
> application itself is stored only once on the hard drive, I can't see
> any way of getting at this through current-pathname.  Of course I could
> prompt the user to locate their preference file, but I would much
> prefer this to be loaded automatically. Any ideas?
>
> Thanks,
>
> -Chris Sims
>
>

-- 
=====================
Joshua Taylor
tayloj@rpi.edu


Re: OSX users/pathnames

At 12:50 PM -0500 1/4/05, Chris R. Sims wrote:
>Hi,
>
>I have an application that will be used by multiple user accounts in 
>OSX.  I would like each user to have a unique preference file stored 
>somewhere in their user directory.  However, to access this file, I 
>need some way of knowing which user is currently logged in (or 
>better, a pathname to the /Users/current_username directory).  Since 
>the application itself is stored only once on the hard drive, I 
>can't see any way of getting at this through current-pathname.  Of 
>course I could prompt the user to locate their preference file, but 
>I would much prefer this to be loaded automatically. Any ideas?

In LispWorks 4.4, (sys:get-folder-path :my-preferences) will return 
the pathname of the user's Preferences folder.

   - Gary


Re: OSX users/pathnames

Do USER-HOMEDIR-PATHNAME and SYSTEM:GET-USER-NAME help?

Cheers

marco




On Jan 4, 2005, at 12:50 PM, Chris R. Sims wrote:

> Hi,
>
> I have an application that will be used by multiple user accounts in 
> OSX.  I would like each user to have a unique preference file stored 
> somewhere in their user directory.  However, to access this file, I 
> need some way of knowing which user is currently logged in (or better, 
> a pathname to the /Users/current_username directory).  Since the 
> application itself is stored only once on the hard drive, I can't see 
> any way of getting at this through current-pathname.  Of course I 
> could prompt the user to locate their preference file, but I would 
> much prefer this to be loaded automatically. Any ideas?
>
> Thanks,
>
> -Chris Sims
>
--
Marco Antoniotti					http://bioinformatics.nyu.edu
NYU Courant Bioinformatics Group		tel. +1 - 212 - 998 3488
715 Broadway 10th FL				fax. +1 - 212 - 998 3484
New York, NY, 10003, U.S.A.


Re: OSX users/pathnames

* Chris R Sims wrote:
> Hi,
> I have an application that will be used by multiple user accounts in 
> OSX.  I would like each user to have a unique preference file stored 
> somewhere in their user directory.  However, to access this file, I 
> need some way of knowing which user is currently logged in (or better, 
> a pathname to the /Users/current_username directory).  Since the 
> application itself is stored only once on the hard drive, I can't see 
> any way of getting at this through current-pathname.  Of course I could 
> prompt the user to locate their preference file, but I would much 
> prefer this to be loaded automatically. Any ideas?

What is the result of USER-HOMEDIR-PATHNAME calls?  This is what it's
for, so I hope it works (it does on Windows and Unix).

--tim


Re: OSX users/pathnames

"Chris R. Sims" <simsc@rpi.edu> writes:

> Any ideas?

I simply use a pathname that begins with "~/". Works fine on both OS X
and linux. You should obey conventions for where to put configuration
files, though, i.e. my OS X config is put in ~/Library/MyProgram
whereas the linux directory is ~/.my-program.
-- 
  (espen)


Re: OSX users/pathnames

John DeSoi <desoi@pgedit.com> writes:

> On OS X it should be ~/Library/Preferences/MyProgram. 

Are you sure? As far as I can tell, only a few programs do that.
E.g. Apple's Mail and Safari both create a ~/Library/<program>
directories (for storing data) and creat .plist files 
(~/Library/Preferences com.apple.mail.plist and 
com.apple.WebFoundation.plist).
-- 
  (espen)


Re: OSX users/pathnames

John DeSoi <desoi@pgedit.com> writes:

> Most of the files in preferences are property lists, but the number of
> application created folders I have in Preferences is greater than the
> number in the Library folder.

I have appr. the same number, and the ones in Preferences seem to
be the carbonized ones...

> Hopefully, "Library" is not localized but I would still like to get

Well, it *is* localized, its name appears to be "Bibliotek" whenever I
put Norwegian language on top of my language preference list, but the
way folder names is localized in OS X is pretty innocent: The names
are translated in Finder and in standard file dialogs, but their real
names are the english ones, and your unix shell and your application
will see those.
-- 
  (espen)


Updated at: 2020-12-10 08:53 UTC