[haiku-development] Re: subversion default config directories on Haiku

On 2009-09-04 at 10:24:54 [+0200], Axel Dörfler <axeld@xxxxxxxxxxxxxxxx> 
wrote:
> Ingo Weinhold <ingo_weinhold@xxxxxx> wrote:
> > On 2009-09-03 at 16:24:59 [+0200], Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
> > > wrote:
> > > Ingo Weinhold <ingo_weinhold@xxxxxx> wrote:
> > > > +#elif defined(__BEOS__)
> > > > +#  define SVN_CONFIG__SYS_DIRECTORY   "/etc/subversion"
> > > Where this one should probably be resolved by find_directory() with
> > > B_COMMON_SETTINGS_DIRECTORY as well.
> > Yeah, unfortunately find_directory() is rather unhandy for use in
> > macros. I
> > guess one has to introduce a function returning the path, using a
> > lazily
> > intialized static variable. This approach falls apart when the macro
> > is
> > used in a context where a string literal is required. Don't know, if
> > that's
> > the case here, though.
> 
> You mean something like:
> {BString|std::string|const char*} compose_path(directory_which which,
> const char* subDirectory);
> ?
>
> The "const char*" version would be the most convenient one, but would
> also never free its directories (which probably wouldn't be a big
> problem if each combination is only allocated once).

I was only thinking of an internal function in the svn code returning said 
"config sys directory", which would use a static variable. I'm not sure how 
useful a Haiku API addition like you propose would be. As long as the 
function can theoretically fail, it wouldn't be so nice to use it in a 
context where a non-null string is expected. And leaking memory isn't nice 
at any rate.

CU, Ingo

Other related posts: