function derive_file_name_to_save(URL_:String):String;
var url1:String;_cache_list,t1:TStringList; wb1,fmap:TINiFile; dirs_,typ_:Integer;
begin
url1:=URL_;
Result:='';
StrReplace(url1,'/','\',[rfIgnoreCase, rfReplaceAll]);
_cache_list:= TStringList.Create;
t1:= TStringList.Create;
wb1:=TIniFile.Create(form2.root+'wikibrowse.ini');
fmap:=TIniFile.Create(form2.root+'Support\dwnld_buf.mng');
wb1.ReadSectionValues('cache',_cache_list);
for dirs_:=0 to _cache_list.Count -1 do begin
fmap.ReadSectionValues(_cache_list.Names[dirs_],t1);
for typ_:=0 to t1.Count -1 do begin
if '.'+lowercase(trim(t1.Names[typ_]))=lowercase(extractfileExt(url1)) then
Result:=IncludeTrailingBackslash(wb1.ReadString('cache',_cache_list.Names[dirs_],'C:'))+extractfilename(url1);
end;
t1.clear;
end;
wb1.free;
fmap.free;
t1.free;
_cache_list.free;
End; |