浏览代码

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

git-svn-id: trunk@38393 -
marcus 7 年之前
父节点
当前提交
ae184f4665
共有 1 个文件被更改,包括 18 次插入0 次删除
  1. 18 0
      rtl/amicommon/sysutils.pp

+ 18 - 0
rtl/amicommon/sysutils.pp

@@ -33,6 +33,7 @@ interface
 {$DEFINE OS_FILESETDATEBYNAME}
 {$DEFINE OS_FILESETDATEBYNAME}
 {$DEFINE HAS_SLEEP}
 {$DEFINE HAS_SLEEP}
 {$DEFINE HAS_OSERROR}
 {$DEFINE HAS_OSERROR}
+{$DEFINE HAS_TEMPDIR}
 
 
 {OS has only 1 byte version for ExecuteProcess}
 {OS has only 1 byte version for ExecuteProcess}
 {$define executeprocuni}
 {$define executeprocuni}
@@ -917,6 +918,23 @@ begin
 end;
 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
                               Initialization code
 ****************************************************************************}
 ****************************************************************************}