Browse Source

* fsplit adapted to long filenames

pierre 27 years ago
parent
commit
2d95ebe899
1 changed files with 33 additions and 8 deletions
  1. 33 8
      rtl/dos/dos.pp

+ 33 - 8
rtl/dos/dos.pp

@@ -829,7 +829,7 @@ end;
 
 
 procedure fsplit(path : pathstr;var dir : dirstr;var name : namestr;var ext : extstr);
 procedure fsplit(path : pathstr;var dir : dirstr;var name : namestr;var ext : extstr);
 var
 var
-   p1,i : longint;
+   dotpos,p1,i : longint;
 begin
 begin
   { allow slash as backslash }
   { allow slash as backslash }
   for i:=1 to length(path) do
   for i:=1 to length(path) do
@@ -854,15 +854,37 @@ begin
        delete(path,1,p1);
        delete(path,1,p1);
     end;
     end;
   { try to find out a extension }
   { try to find out a extension }
-  p1:=pos('.',path);
-  if p1>0 then
+{$ifdef Go32V2}
+  if LFNSupport then
     begin
     begin
-       ext:=copy(path,p1,4);
-       delete(path,p1,length(path)-p1+1);
+       Ext:='';
+       i:=Length(Path);
+       DotPos:=256;
+       While (i>0) Do
+         Begin
+            If (Path[i]='.') Then
+              begin
+                 DotPos:=i;
+                 break;
+              end;
+            Dec(i);
+         end;
+       Ext:=Copy(Path,DotPos,255);
+       Name:=Copy(Path,1,DotPos - 1);
     end
     end
   else
   else
-    ext:='';
-  name:=path;
+{$endif Go32V2}
+    begin
+       p1:=pos('.',path);
+       if p1>0 then
+         begin
+            ext:=copy(path,p1,4);
+            delete(path,p1,length(path)-p1+1);
+         end
+       else
+         ext:='';
+       name:=path;
+    end;
 end;
 end;
 
 
 
 
@@ -1129,7 +1151,10 @@ End;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.13  1998-09-16 16:47:24  peter
+  Revision 1.14  1998-10-22 15:05:28  pierre
+   * fsplit adapted to long filenames
+
+  Revision 1.13  1998/09/16 16:47:24  peter
     * merged fixes
     * merged fixes
 
 
   Revision 1.11.2.2  1998/09/16 16:16:04  peter
   Revision 1.11.2.2  1998/09/16 16:16:04  peter