Bläddra i källkod

Bug 1547: Do not display error message on start when user documents folder cannot be resolved

https://winscp.net/tracker/1547

Source commit: 6c711e251ad11dcf3bd0afd71f9f3a53bc5617ee
Martin Prikryl 8 år sedan
förälder
incheckning
df34a0bf87
2 ändrade filer med 10 tillägg och 2 borttagningar
  1. 8 1
      source/packages/filemng/BaseUtils.pas
  2. 2 1
      source/packages/filemng/DirView.pas

+ 8 - 1
source/packages/filemng/BaseUtils.pas

@@ -339,7 +339,14 @@ begin
   Result :=
     (not Failed(SHGetSpecialFolderLocation(Application.Handle, Folder, PIDL))) and
     SHGetPathFromIDList(PIDL, PChar(Path));
-  if Result then SetLength(Path, StrLen(PChar(Path)));
+  if Result then
+  begin
+    SetLength(Path, StrLen(PChar(Path)));
+  end
+    else
+  begin
+    Path := '';
+  end;
 end;
 
 function SpecialFolderLocation(Folder: Integer; var Path: string): Boolean;

+ 2 - 1
source/packages/filemng/DirView.pas

@@ -750,7 +750,8 @@ begin
     else
   begin
     Result := UserDocumentDirectory;
-    if IsUNCPath(Result) then
+    if (Result = '') or // in rare case the CSIDL_PERSONAL cannot be resolved
+       IsUNCPath(Result) then
     begin
       Result := AnyValidPath;
     end;