Browse Source

Bug fix: Browsing long paths was broken by 9a54ec5f (Using large fetch and not reading short names when reading directories for file panel)

Would add \\? prefix to tree and drive combobox

Source commit: 7b862e177adf09600a200921dec1d4f1e055b049
Martin Prikryl 1 year ago
parent
commit
5635eeddf0
1 changed files with 6 additions and 0 deletions
  1. 6 0
      source/packages/filemng/DirView.pas

+ 6 - 0
source/packages/filemng/DirView.pas

@@ -811,6 +811,8 @@ begin
 end;
 
 procedure TDirView.SetPath(Value: string);
+const
+  LongPathPrefix = '\\?\';
 var
   LongPath: string;
   Len: Integer;
@@ -831,7 +833,11 @@ begin
     SetLength(LongPath, Len);
     Len := GetLongPathName(PChar(ApiPath(Value)), PChar(LongPath), Len);
     if Len > 0 then
+    begin
       Value := Copy(LongPath, 1, Len);
+      if StartsStr(LongPathPrefix, Value) then
+        System.Delete(Value, 1, Length(LongPathPrefix));
+    end;
   end;
 
   CheckCanOpenDirectory(Value);