Hi.
I trying to use the GetTempDir, but I get only partial result, e.g.:
\xampp\tmp\
Was to be:
C:\xampp\tmp\
How to I get the complete path of temp dir of server (Apache)?
Thx.
ps. Sorry for my english. ^^'

Mailing lists / lazarus / 2011-06
7 messages · 3 people ·
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
Hi.
I trying to use the GetTempDir, but I get only partial result, e.g.:
\xampp\tmp\
Was to be:
C:\xampp\tmp\
How to I get the complete path of temp dir of server (Apache)?
Thx.
ps. Sorry for my english. ^^'
Oops, the correct title is:
"GetTempDir return a partial path".
2011/6/15 silvioprog :
It might be that your TEMP or TMP environment variable does not have the drive letter.
AB
Oops, the correct title is: "GetTempDir return a partial path". 2011/6/15 silvioprog :…
GetTempDir returns the contents of the TEMP or TMP environment variable. If you get one without drive, it is what Apache passes to your CGI program.
You can also use the windows unit GetTempPath function, but that is not portable.
Maybe we can change the windows version of the GetTempDir() function to use GetTempPath instead.
Michael.
...<SNIP>...
...<SNIP>...
Michael.
One note on that:
Apache does not pass the TEMP environment variable to CGI programs automatically, you need to tell it to do that in the Apache configuration file with a
PassEnv TEMP
(passes the TEMP environment variable as it is defined) or
SetEnv TEMP "c:/path/to/tmp/dir"
(sets the TEMP variable with the given value for the CGI program)
AB
Thanks to all. o/
Solved:
function GetTempDirectory: String;
{$IFDEF MSWINDOWS}
var
VTempFolder: array[0..MAX_PATH] of Char;
{$ENDIF}
begin
{$IFDEF UNIX}
Result := GetTempDir;
{$ENDIF}
{$IFDEF MSWINDOWS}
GetTempPath(MAX_PATH, @VTempFolder);
Result := StrPas(VTempFolder);
{$ENDIF}
end;GetTempDir returns the contents of the TEMP or TMP environment variable. If you get one…
2011/6/15 Michael Van Canneyt :
[...]
Maybe we can change the windows version of the GetTempDir() function to use GetTempPath instead.
Good idea. ^^
Michael.