apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject what's the portable temp dir?
Date Wed, 17 Apr 2002 09:37:14 GMT
Any chance APR will handle a portable apr_get_temp_dir function? (which 
returns the existing writable temp path) which then could be used to 
create a template wanted by apr_file_mktemp().

e.g. perl's CGI.pm which is used on many platforms uses this hardcoded 
array where it then searches for the first writable directory (at 
compile time)

$SL = $CGI::SL;
$MAC = $CGI::OS eq 'MACINTOSH';
my ($vol) = $MAC ? MacPerl::Volumes() =~ /:(.*)/ : "";
     @TEMP=("${SL}usr${SL}tmp","${SL}var${SL}tmp",
	   "C:${SL}temp","${SL}tmp","${SL}temp",
	   "${vol}${SL}Temporary Items",
            "${SL}WWW_ROOT", "${SL}SYS\$SCRATCH",
	   "C:${SL}system${SL}temp");
     unshift(@TEMP,$ENV{'TMPDIR'}) if exists $ENV{'TMPDIR'};

of course if we can use existing library functions that would be more 
portable I think.

POSIX systems has tmpnam().
BSD 4.3 has tempnam().
That's all I know.

Can we re-use such a function from another project that runs on many 
platforms? NSPR comes to mind. http://www.mozilla.org/projects/nspr/


__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Mime
View raw message