summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4b8454c)
raw | patch | inline | side by side (parent: 4b8454c)
author | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Sun, 17 Apr 2016 05:57:16 +0000 (08:57 +0300) | ||
committer | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Sun, 17 Apr 2016 05:57:16 +0000 (08:57 +0300) |
src/game/g_res_downloader.pas | patch | blob | history | |
src/sfs/sfs.pas | patch | blob | history | |
src/shared/WADEDITOR.pas | patch | blob | history |
index 9547335009a7296361e17b018196f7e6846c3278..fc815dabc5b526302cc20640885a782a0f1e88d0 100644 (file)
implementation
-uses g_language;
+uses g_language, sfs, WADEDITOR;
const DOWNLOAD_DIR = 'downloads';
repeat
if (searchResult.Attr and faDirectory) = 0 then
begin
- if searchResult.Name = filename then
+ if SFSStrEqu(searchResult.Name, filename) then
begin
files.Add(dirName+'/'+filename);
Exit;
end;
end
else if (searchResult.Name <> '.') and (searchResult.Name <> '..') then
- FindFiles(IncludeTrailingPathDelimiter(dirName)+searchResult.Name,
- filename, files);
+ FindFiles(IncludeTrailingPathDelimiter(dirName)+searchResult.Name, filename, files);
until FindNext(searchResult) <> 0;
finally
FindClose(searchResult);
function CompareFileHash(const filename: string; const resMd5: TMD5Digest): Boolean;
var
gResHash: TMD5Digest;
+ fname: string;
begin
- gResHash := MD5File(filename);
+ fname := findDiskWad(filename);
+ if length(fname) = 0 then begin result := false; exit; end;
+ gResHash := MD5File(fname);
Result := MD5Match(gResHash, resMd5);
end;
function CheckFileHash(const path, filename: string; const resMd5: TMD5Digest): Boolean;
+var
+ fname: string;
begin
- Result := FileExists(path + filename) and CompareFileHash(path + filename, resMd5);
+ fname := findDiskWad(path+filename);
+ if length(fname) = 0 then begin result := false; exit; end;
+ Result := FileExists(fname) and CompareFileHash(fname, resMd5);
end;
function g_Res_SearchSameWAD(const path, filename: string; const resMd5: TMD5Digest): string;
diff --git a/src/sfs/sfs.pas b/src/sfs/sfs.pas
index 7e466ce39701dd7ca88471e4e86171ce27413f99..69e4368573d2546f6ddbaaceff5da34d34ae5fbf 100644 (file)
--- a/src/sfs/sfs.pas
+++ b/src/sfs/sfs.pas
function WildListMatch (wildList, text: TSFSString; delimChar: AnsiChar=':'): Integer;
function HasWildcards (const pattern: TSFSString): Boolean;
-// this will compare only last path element from sfspath
-function SFSDFPathEqu (sfspath: string; path: string): Boolean;
-
function SFSUpCase (ch: Char): Char;
function utf8to1251 (s: TSFSString): TSFSString;
result := true;
end;
-// this will compare only last path element from sfspath
-function SFSDFPathEqu (sfspath: string; path: string): Boolean;
-{var
- i: Integer;}
-begin
- result := SFSStrEqu(sfspath, path);
-(*
- if not result and (length(sfspath) > 1) then
- begin
- i := length(sfspath);
- while i > 1 do
- begin
- while (i > 1) and (sfspath[i-1] <> '/') do Dec(i);
- if i <= 1 then exit;
- writeln('{', sfspath, '} [', Copy(sfspath, i, length(sfspath)), '] : [', path, ']');
- result := SFSStrEqu(Copy(sfspath, i, length(sfspath)), path);
- end;
- end;
-*)
-end;
-
// adds '/' too
function normalizePath (fn: string): string;
var
index 4434e45e7adde1ae8fc8501fae4a526763d44674..d41acfaa8a83a67b96b9d2f3f1ff5ab0cbf7345d 100644 (file)
--- a/src/shared/WADEDITOR.pas
+++ b/src/shared/WADEDITOR.pas
fi := fIter.Files[f];
if fi = nil then continue;
//e_WriteLog(Format('DFWAD: searching for [%s : %s] in [%s]; current is [%s : %s]', [Section, Resource, fFileName, fi.path, fi.name]), MSG_NOTIFY);
- if {SFSStrEqu}SFSDFPathEqu(fi.path, Section) and SFSStrEqu(removeExt(fi.name), Resource) then
+ if SFSStrEqu(fi.path, Section) and SFSStrEqu(removeExt(fi.name), Resource) then
begin
// i found her!
//fn := fFileName+'::'+fi.path+fi.name;
fi := fIter.Files[f];
if fi = nil then continue;
if length(fi.name) = 0 then continue;
- if {SFSStrEqu}SFSDFPathEqu(fi.path, Section) then
+ if SFSStrEqu(fi.path, Section) then
begin
SetLength(result, Length(result)+1);
result[high(result)] := removeExt(fi.name);