Lisp HUG Maillist Archive

RE: My Documents folder

 

> -----Original Message-----
> From: owner-lisp-hug@lispworks.com 
> [mailto:owner-lisp-hug@lispworks.com] On Behalf Of Marco Antoniotti
> Sent: Friday, December 01, 2006 1:54 PM
> To: Sheldon Ball
> Cc: Lisp Hug Lispworks
> Subject: Re: My Documents folder
> 
> 
> 
> On Dec 1, 2006, at 4:01 AM, Sheldon Ball wrote:
> 
> > I would like to be able to set a directory specific for 
> each user for 
> > printing documents from LWW5.
> > I thought:
> >
> > (setf *document_dir*
> >       (concatenate 'string
>            ^^^^^^^^^^^    Bad bad bad idea!!!!
> >                    (format-pathname (sys:get-folder-path
> > :my-documents))
> >                    "/"))
> >
> > within the initialization function of deliver would obtain 
> that folder 
> > when a user starts the application, but this seems not 
> necessarily the 
> > case.
> >
> > For example, the value of *document_dir* at the time the 
> application 
> > was delivered was:
> > C:\Documents and Settings\Sheldon Ball\ On computers at the 
> Veterans 
> > Administration, my "My Documents" folder
> > is:
> > C:\Documents and Settings\Sheldon Ball\vhamacballsh\My Documents\
> >
> > The 'vhamacballsh' folder is my user name.
> 
> 	(merge-pathnames "My Documents/" (user-homedir-pathname))
> 
> is more kosher and less error prone.  

No, it's guaranteed erroneous on non-english Windows.


In fact, (sys:get-folder-path :my-documents) should do exactly what Sheldon Ball wants it to. The problem may well be with the unorthodox path-building with concatenate.

The error number, 5, is probably form Windows. If so, it means "No access". Perhaps the user doesn't have the right to create subdirectories in his 'Mine dokumenter' (would be strange though).


Actually, reading the original post again, I see that the error message concerns the directory

C:\Documents and Settings\Sheldon Ball\vhamacballsh\My Documents\

which seems to have two usernames in its path. Perhaps it should have been

C:\Documents and Settings\vhamacballsh\My Documents\

So the error may indeed be the path-building.



Eivind



Re: My Documents folder


On Dec 1, 2006, at 2:58 PM, Eivind Midtgård wrote:

>
>
>
>> -----Original Message-----
>> From: owner-lisp-hug@lispworks.com
>> [mailto:owner-lisp-hug@lispworks.com] On Behalf Of Marco Antoniotti
>> Sent: Friday, December 01, 2006 1:54 PM
>> To: Sheldon Ball
>> Cc: Lisp Hug Lispworks
>> Subject: Re: My Documents folder
>>
>>
>>
>> On Dec 1, 2006, at 4:01 AM, Sheldon Ball wrote:
>>
>>> I would like to be able to set a directory specific for
>> each user for
>>> printing documents from LWW5.
>>> I thought:
>>>
>>> (setf *document_dir*
>>>       (concatenate 'string
>>            ^^^^^^^^^^^    Bad bad bad idea!!!!
>>>                    (format-pathname (sys:get-folder-path
>>> :my-documents))
>>>                    "/"))
>>>
>>> within the initialization function of deliver would obtain
>> that folder
>>> when a user starts the application, but this seems not
>> necessarily the
>>> case.
>>>
>>> For example, the value of *document_dir* at the time the
>> application
>>> was delivered was:
>>> C:\Documents and Settings\Sheldon Ball\ On computers at the
>> Veterans
>>> Administration, my "My Documents" folder
>>> is:
>>> C:\Documents and Settings\Sheldon Ball\vhamacballsh\My Documents\
>>>
>>> The 'vhamacballsh' folder is my user name.
>>
>> 	(merge-pathnames "My Documents/" (user-homedir-pathname))
>>
>> is more kosher and less error prone.
>
> No, it's guaranteed erroneous on non-english Windows.

Yes.  In my italian version I would have to do

	(merge-pathnames "Documenti/" (user-homedir-pathname))

> In fact, (sys:get-folder-path :my-documents) should do exactly what 
> Sheldon Ball wants it to.

sys:get-folder-path is LW dependent and the assumption about the 
existence of a "My Document" is Windows dependent. Moreover, 
internationalization issues go beyond the location of "My Documents".

> The problem may well be with the unorthodox path-building with 
> concatenate.

Yes.  Using CONCATENATE to manipulate pathnames is a recipe for endless 
annoyances (although LW is particularly good to make several of these 
issues go away)


Cheers
--
Marco



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