Boost logo

Boost :

Subject: Re: [boost] [filesystem] home_directory_path
From: Chad Nelson (chad.thecomfychair_at_[hidden])
Date: 2010-10-20 18:44:02

On Wed, 20 Oct 2010 14:45:55 -0400
"Stewart, Robert" <Robert.Stewart_at_[hidden]> wrote:

>> Automatically saving user-generated content into it is
>> wrong. Returning it from that function might not be, if there's
>> no better logical candidate.
> That distinction is interesting, but is it necessary that the function
> have a default on POSIX systems? We've suggested ideas on how that
> could be set by the client, according to some local policy without
> Filesystem having to impose an opinion on what is most appropriate.

Necessary, no. But it would simplify using it if it did. Then, if I
didn't need anything different from the default (as I doubt I ever
would, in this case), I wouldn't have to do anything to it in order to
port my program from one OS to the other. It would just work,
automatically. Without a default, it's another thing I'd have to think

>> Since the requested directory *is* explicitly for user-generated
>> content, presumably most programs would use the returned path to pop
>> up a load/save dialog to the user (who would then manually navigate
>> to his preferred subdirectory for his documents), or would append
>> their own subdirectory names to it before silently saving files.
> Saving in or under My Documents is not so unlike saving in or under
> one's home directory. Perhaps I'm too stridently against content
> being put into the home directory thus not wanting to encourage that
> by making it the default.

If Linux users were like the majority of Windows users, I'd agree
wholeheartedly with your position. But the majority of Linux users are
still power users, at the very least. If they save something in their
home directory, it's because they explicitly want it there.

(As an aside, I've only got five non-dot files in my home directory,
all deliberately placed there for logical reasons.)

>> So long as the behavior is documented, I don't think it would
>> be a problem. As a developer it's what I'd want, because if I
>> had to write OS-specific changes to my program to make it work,
>> it would be a lot less useful to me.
> Your notion of an app saving the user's last directory is reasonable,
> meaning that the My Documents directory, or its equivalent, would be
> used only when there is no user-driven default available. Since the
> home directory is at least the parent of the directory in which the
> user would want to put a file, its use in that scenario is not
> unreasonable.

Yes, exactly.

> If Filesystem offered a means to override the path returned by
> home_directory_path() (or however it's spelled), then those that
> prefer something else can set it and those that prefer the home
> directory can leave the default.

Sounds good to me. :-)

> BTW, it would be better to refer to the result as the "documents
> directory" instead of the home directory since there isn't a good
> notion of home directory on Windows. Thus, documents_directory_path()
> or get_os_path(path_documents) (or something along those lines).

Certainly. There was also some discussion about including the APPDATA
directory in Windows, which would also map to the user's home directory
under *NIX, and which could cause some confusion otherwise.

Chad Nelson
Oak Circle Software, Inc.

Boost list run by bdawes at, gregod at, cpdaniel at, john at