Ver código fonte

* Switch to classic field names to prevent further messing with compatibility.

git-svn-id: trunk@6964 -
daniel 18 anos atrás
pai
commit
8127fb7a05
2 arquivos alterados com 23 adições e 21 exclusões
  1. 13 11
      rtl/unix/dos.pp
  2. 10 10
      rtl/unix/sysutils.pp

+ 13 - 11
rtl/unix/dos.pp

@@ -31,7 +31,8 @@ Type
     DirPtr     : Pointer;     {directory pointer for reading directory}
     SearchType : Byte;        {0=normal, 1=open will close, 2=only 1 file}
     SearchAttr : Byte;        {attribute we are searching for}
-    Fill       : Array[1..03] of Byte; {future use}
+    Mode       : Word;
+    Fill       : Array[1..1] of Byte; {future use}
   {End of fill}
     Attr       : Byte;        {attribute of found file}
     Time       : LongInt;     {last modify date of found file}
@@ -558,26 +559,27 @@ begin
   FindGetFileInfo:=false;
   if not fpstat(s,st)>=0 then
    exit;
-  info.FSize:=st.st_Size;
-  info.FMTime:=st.st_mtime;
-  if (st.st_mode and STAT_IFMT)=STAT_IFDIR then
+  info.FSize:=st.size;
+  info.FMTime:=st.mtime;
+  if (st.mode and STAT_IFMT)=STAT_IFDIR then
    info.fmode:=$10
   else
    info.fmode:=$0;
-  if (st.st_mode and STAT_IWUSR)=0 then
+  if (st.mode and STAT_IWUSR)=0 then
    info.fmode:=info.fmode or 1;
   if s[f.NamePos+1]='.' then
    info.fmode:=info.fmode or $2;
 
-  If ((Info.FMode and Not(f.searchattr))=0) Then
-   Begin
+  if Info.FMode and Not(f.searchattr)=0 Then
+   begin
      f.Name:=Copy(s,f.NamePos+1,255);
      f.Attr:=Info.FMode;
+     f.Mode:=word(st.mode);
      f.Size:=Info.FSize;
      UnixDateToDT(Info.FMTime, DT);
      PackTime(DT,f.Time);
      FindGetFileInfo:=true;
-   End;
+   end;
 end;
 
 
@@ -755,7 +757,7 @@ Function FSearch(path : pathstr;dirlist : string) : pathstr;
 Var
   info : BaseUnix.stat;
 Begin
-  if (length(Path)>0) and (path[1]='/') and (fpStat(path,info)>=0) and (not fpS_ISDIR(Info.st_Mode)) then
+  if (length(Path)>0) and (path[1]='/') and (fpStat(path,info)>=0) and (not fpS_ISDIR(Info.mode)) then
     FSearch:=path
   else
     FSearch:=Unix.FSearch(path,dirlist);
@@ -774,7 +776,7 @@ Begin
      exit;
    end
   else
-   LinAttr:=Info.st_Mode;
+   LinAttr:=Info.mode;
   if fpS_ISDIR(LinAttr) then
    Attr:=$10
   else
@@ -798,7 +800,7 @@ Begin
      exit
    end
   else
-   UnixDateToDT(Info.st_mTime,DT);
+   UnixDateToDT(Info.mTime,DT);
   PackTime(DT,Time);
 End;
 

+ 10 - 10
rtl/unix/sysutils.pp

@@ -267,7 +267,7 @@ begin
   If  fpstat (FileName,Info)<0 then
     exit(-1)
   else
-    Result:=UnixToWinAge(info.st_mtime);
+    Result:=UnixToWinAge(info.mtime);
 end;
 
 
@@ -285,7 +285,7 @@ Function DirectoryExists (Const Directory : String) : Boolean;
 Var Info : Stat;
 
 begin
-  DirectoryExists:=(fpstat(Directory,Info)>=0) and fpS_ISDIR(Info.st_mode);
+  DirectoryExists:=(fpstat(Directory,Info)>=0) and fpS_ISDIR(Info.mode);
 end;
 
 
@@ -293,15 +293,15 @@ Function LinuxToWinAttr (FN : Pchar; Const Info : Stat) : Longint;
 
 begin
   Result:=faArchive;
-  If fpS_ISDIR(Info.st_mode) then
+  If fpS_ISDIR(Info.mode) then
     Result:=Result or faDirectory;
   If (FN[0]='.') and (not (FN[1] in [#0,'.']))  then
     Result:=Result or faHidden;
-  If (Info.st_Mode and S_IWUSR)=0 Then
+  If (Info.Mode and S_IWUSR)=0 Then
      Result:=Result or faReadOnly;
-  If fpS_ISSOCK(Info.st_mode) or fpS_ISBLK(Info.st_mode) or fpS_ISCHR(Info.st_mode) or fpS_ISFIFO(Info.st_mode) Then
+  If fpS_ISSOCK(Info.mode) or fpS_ISBLK(Info.mode) or fpS_ISCHR(Info.mode) or fpS_ISFIFO(Info.mode) Then
      Result:=Result or faSysFile;
-  If fpS_ISLNK(Info.st_mode) Then
+  If fpS_ISLNK(Info.mode) Then
     Result:=Result or faSymLink;
 end;
 
@@ -430,9 +430,9 @@ begin
    Begin
      f.Name:=ExtractFileName(s);
      f.Attr:=WinAttr;
-     f.Size:=st.st_Size;
-     f.Mode:=st.st_mode;
-     f.Time:=UnixToWinAge(st.st_mtime);
+     f.Size:=st.Size;
+     f.Mode:=st.mode;
+     f.Time:=UnixToWinAge(st.mtime);
      result:=true;
    End;
 end;
@@ -537,7 +537,7 @@ begin
   If (fpFStat(Handle,Info))<0 then
     Result:=-1
   else
-    Result:=Info.st_Mtime;
+    Result:=Info.Mtime;
 end;