Browse Source

* more fexpand fixes from marco van de voort

peter 27 years ago
parent
commit
01d83fc3ec
1 changed files with 21 additions and 5 deletions
  1. 21 5
      rtl/dos/dos.pp

+ 21 - 5
rtl/dos/dos.pp

@@ -901,23 +901,36 @@ end;
 
 
     function fexpand(const path : pathstr) : pathstr;
     function fexpand(const path : pathstr) : pathstr;
        var
        var
-         s,pa : string;
+         s,pa : pathstr;
          i,j  : longint;
          i,j  : longint;
        begin
        begin
           getdir(0,s);
           getdir(0,s);
-          pa:=upcase(path);
+          if LFNSupport then
+           begin
+             pa:=path;
+             { Always uppercase driveletter }
+             if (length(pa)>1) and (pa[2]=':') and (pa[1] in ['a'..'z']) then
+              pa[1]:=CHR(ORD(Pa[1])-32);
+           end
+          else
+           pa:=upcase(path);
           { allow slash as backslash }
           { allow slash as backslash }
           for i:=1 to length(pa) do
           for i:=1 to length(pa) do
            if pa[i]='/' then
            if pa[i]='/' then
             pa[i]:='\';
             pa[i]:='\';
 
 
-          if (length(pa)>1) and (pa[1] in ['A'..'Z']) and (pa[2]=':') then
+          if (length(pa)>1) and (pa[2]=':') and (pa[1] in ['A'..'Z']) then
             begin
             begin
                { we must get the right directory }
                { we must get the right directory }
                getdir(ord(pa[1])-ord('A')+1,s);
                getdir(ord(pa[1])-ord('A')+1,s);
                if (ord(pa[0])>2) and (pa[3]<>'\') then
                if (ord(pa[0])>2) and (pa[3]<>'\') then
                  if pa[1]=s[1] then
                  if pa[1]=s[1] then
-                   pa:=s+'\'+copy (pa,3,length(pa))
+                   begin
+                     { remove ending slash if it already exists }
+                     if s[length(s)]='\' then
+                      dec(s[0]);
+                     pa:=s+'\'+copy (pa,3,length(pa));
+                   end
                  else
                  else
                    pa:=pa[1]+':\'+copy (pa,3,length(pa))
                    pa:=pa[1]+':\'+copy (pa,3,length(pa))
             end
             end
@@ -1162,7 +1175,10 @@ End;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.18  1998-11-23 12:48:02  peter
+  Revision 1.19  1998-11-23 13:53:59  peter
+    * more fexpand fixes from marco van de voort
+
+  Revision 1.18  1998/11/23 12:48:02  peter
     * fexpand('o:') fixed to return o:\ (from the mailinglist)
     * fexpand('o:') fixed to return o:\ (from the mailinglist)
 
 
   Revision 1.17  1998/11/22 09:33:21  florian
   Revision 1.17  1998/11/22 09:33:21  florian