|
@@ -2785,6 +2785,7 @@ end;
|
|
|
procedure TDirView.ExecuteDrive(Drive: string);
|
|
procedure TDirView.ExecuteDrive(Drive: string);
|
|
|
var
|
|
var
|
|
|
APath: string;
|
|
APath: string;
|
|
|
|
|
+ DriveRoot: string;
|
|
|
begin
|
|
begin
|
|
|
if Assigned(FLastPath) and FLastPath.ContainsKey(Drive) then
|
|
if Assigned(FLastPath) and FLastPath.ContainsKey(Drive) then
|
|
|
begin
|
|
begin
|
|
@@ -2802,6 +2803,11 @@ begin
|
|
|
if DriveInfo.IsRealDrive(Drive) then
|
|
if DriveInfo.IsRealDrive(Drive) then
|
|
|
begin
|
|
begin
|
|
|
GetDir(Integer(Drive[1]) - Integer('A') + 1, APath);
|
|
GetDir(Integer(Drive[1]) - Integer('A') + 1, APath);
|
|
|
|
|
+ DriveRoot := DriveInfo.GetDriveRoot(Drive);
|
|
|
|
|
+ // When the drive is not valid, the GetDir returns the current drive working directory, detect that,
|
|
|
|
|
+ // and let it fail later when trying to open root of the invalid drive.
|
|
|
|
|
+ if not StartsText(DriveRoot, APath) then
|
|
|
|
|
+ APath := DriveRoot;
|
|
|
APath := ExcludeTrailingPathDelimiter(APath);
|
|
APath := ExcludeTrailingPathDelimiter(APath);
|
|
|
end
|
|
end
|
|
|
else
|
|
else
|