ADD: Special case for smb:// protocol

This commit is contained in:
Alexander Koblov 2017-02-24 13:44:26 +00:00
commit 4f2bae9652
2 changed files with 18 additions and 8 deletions

View file

@ -344,7 +344,7 @@ type
constructor Create;
destructor Destroy; override;
function Find(FileSourceClass: TClass; Address: String): IFileSource;
function Find(FileSourceClass: TClass; Address: String; CaseSensitive: Boolean = True): IFileSource;
end;
EFileSourceException = class(Exception);
@ -921,16 +921,23 @@ begin
FFileSources.Remove(aFileSource);
end;
function TFileSourceManager.Find(FileSourceClass: TClass; Address: String): IFileSource;
function TFileSourceManager.Find(FileSourceClass: TClass; Address: String;
CaseSensitive: Boolean): IFileSource;
var
i: Integer;
I: Integer;
StrCmp: function(const S1, S2: String): Integer;
begin
for i := 0 to FFileSources.Count - 1 do
if CaseSensitive then
StrCmp:= @CompareStr
else begin
StrCmp:= @CompareText;
end;
for I := 0 to FFileSources.Count - 1 do
begin
if (FFileSources[i].IsClass(FileSourceClass)) and
(FFileSources[i].CurrentAddress = Address) then
if (FFileSources[I].IsClass(FileSourceClass)) and
(StrCmp(FFileSources[I].CurrentAddress, Address) = 0) then
begin
Result := FFileSources[i];
Result := FFileSources[I];
Exit;
end;
end;

View file

@ -197,7 +197,10 @@ begin
URI:= ParseURI(aPath);
RemotePath:= NormalizePathDelimiters(URI.Path + URI.Document);
RemotePath:= IncludeTrailingPathDelimiter(RemotePath);
FileSource:= FileSourceManager.Find(aFileSourceClass, URI.Protocol + '://' + URI.Host);
FileSource:= FileSourceManager.Find(aFileSourceClass,
URI.Protocol + '://' + URI.Host,
not SameText(URI.Protocol, 'smb')
);
if Assigned(FileSource) then
aFileView.AddFileSource(FileSource, RemotePath)
else begin