In this situation I would use something like
ap_server_root_relative() and prepend the 'logs' part to whatever your
cache file name is. I'm not positive that this guarantees that you get
an existing directory, though.

Your safest bet is to retain your directive but make it optional. Set
a default location with the above when you create your config, and
then if the user sets a different directory in which to store the
files, you just reset it to that. If you test the directory before you
continue, you should be ok.

Josh

On 4/5/07, David Wortham <[EMAIL PROTECTED]> wrote:
In reference to my last question (about finding a suitable cache-file
directory), I found this function in the httpd-2.2.x source:
apr_temp_dir_get(char** temp_dir, apr_pool t* p).

Has anyone used this function or does anyone know if it is (or is not) fully
supported by all apache implementations?  Is it guaranteed to return a
writeable directory?

Thanks,
Dave





On 4/4/07, David Wortham <[EMAIL PROTECTED]> wrote:
>
> Sorry for such a simple question, but I have not been able to find the
> answer yet.
>
> Is there a function in APR to retrieve the default Apache logs directory?
>
> When my module starts up, it needs to create cache files if they don't
> already exist (which happens before directives are traversed).  I have a
> directive to accept a custom logs directory (which seems to work fine), but
> I would like my module to be able to work (as in: not attempt to write to a
> directory which doesn't exist) without any necessary directives.  Any
> ideas?  Anyone know of an existing module which may have the code I want?
>
> I'm already in the process of doing lstat-related testing to ensure I'm
> not trying to write to a directory which doesn't exist.
>
> My module is coded in C running under Apache 2.0.54 on Linux and I am
> hoping to keep it platform-independent.
>
> Thanks in advance,
> Dave
> --
> David Wortham
> Senior Web Applications Developer
> Unspam Technologies, Inc.




--
David Wortham
Senior Web Applications Developer
Unspam Technologies, Inc.
1901 Prospector Dr. #30
Park City, UT 84060
(435) 513-0672

Reply via email to