瀏覽代碼

+ Made AddDisk a function, returning the current number of drives.

git-svn-id: trunk@3816 -
michael 19 年之前
父節點
當前提交
e73bc0b772
共有 2 個文件被更改,包括 7 次插入5 次删除
  1. 4 3
      rtl/unix/dos.pp
  2. 3 2
      rtl/unix/sysutils.pp

+ 4 - 3
rtl/unix/dos.pp

@@ -51,7 +51,7 @@ Procedure UnixDateToDt(SecsPast: LongInt; Var Dt: DateTime);
 Function  DTToUnixDate(DT: DateTime): LongInt;
 Function  DTToUnixDate(DT: DateTime): LongInt;
 
 
 {Disk}
 {Disk}
-Procedure AddDisk(const path:string);
+Function AddDisk(const path:string) : byte;
 
 
 Implementation
 Implementation
 
 
@@ -384,7 +384,7 @@ const
 var
 var
   DriveStr : array[4..26] of pchar;
   DriveStr : array[4..26] of pchar;
 
 
-Procedure AddDisk(const path:string);
+Function AddDisk(const path:string) : byte;
 begin
 begin
   if not (DriveStr[Drives]=nil) then
   if not (DriveStr[Drives]=nil) then
    FreeMem(DriveStr[Drives],StrLen(DriveStr[Drives])+1);
    FreeMem(DriveStr[Drives],StrLen(DriveStr[Drives])+1);
@@ -392,7 +392,8 @@ begin
   StrPCopy(DriveStr[Drives],path);
   StrPCopy(DriveStr[Drives],path);
   inc(Drives);
   inc(Drives);
   if Drives>26 then
   if Drives>26 then
-   Drives:=4;
+    Drives:=4;
+  AddDisk:=Drives; 
 end;
 end;
 
 
 
 

+ 3 - 2
rtl/unix/sysutils.pp

@@ -38,7 +38,7 @@ uses
 { Include platform independent interface part }
 { Include platform independent interface part }
 {$i sysutilh.inc}
 {$i sysutilh.inc}
 
 
-Procedure AddDisk(const path:string);
+Function AddDisk(const path:string) : Byte;
 
 
 { the following is Kylix compatibility stuff, it should be moved to a
 { the following is Kylix compatibility stuff, it should be moved to a
   special compatibilty unit (FK) }
   special compatibilty unit (FK) }
@@ -717,7 +717,7 @@ var
   Drives   : byte;
   Drives   : byte;
   DriveStr : array[4..26] of pchar;
   DriveStr : array[4..26] of pchar;
 
 
-Procedure AddDisk(const path:string);
+Function AddDisk(const path:string) : Byte;
 begin
 begin
   if not (DriveStr[Drives]=nil) then
   if not (DriveStr[Drives]=nil) then
    FreeMem(DriveStr[Drives],StrLen(DriveStr[Drives])+1);
    FreeMem(DriveStr[Drives],StrLen(DriveStr[Drives])+1);
@@ -726,6 +726,7 @@ begin
   inc(Drives);
   inc(Drives);
   if Drives>26 then
   if Drives>26 then
    Drives:=4;
    Drives:=4;
+  Result:=Drives; 
 end;
 end;