Explorar o código

Amicommon: Implemented GetTempDir() for all Amiga systems ('T:' as default)

git-svn-id: trunk@38393 -
marcus %!s(int64=7) %!d(string=hai) anos
pai
achega
ae184f4665
Modificáronse 1 ficheiros con 18 adicións e 0 borrados
  1. 18 0
      rtl/amicommon/sysutils.pp

+ 18 - 0
rtl/amicommon/sysutils.pp

@@ -33,6 +33,7 @@ interface
 {$DEFINE OS_FILESETDATEBYNAME}
 {$DEFINE HAS_SLEEP}
 {$DEFINE HAS_OSERROR}
+{$DEFINE HAS_TEMPDIR}
 
 {OS has only 1 byte version for ExecuteProcess}
 {$define executeprocuni}
@@ -917,6 +918,23 @@ begin
 end;
 
 
+function GetTempDir(Global: Boolean): string;
+begin
+  if Assigned(OnGetTempDir) then
+    Result := OnGetTempDir(Global)
+  else
+  begin
+    Result := GetEnvironmentVariable('TEMP');
+    if Result = '' Then
+      Result:=GetEnvironmentVariable('TMP');
+    if Result = '' then
+      Result := 'T:'; // fallback.
+  end;
+  if Result <> '' then
+    Result := IncludeTrailingPathDelimiter(Result);
+end;
+
+
 {****************************************************************************
                               Initialization code
 ****************************************************************************}