summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f587b1e)
raw | patch | inline | side by side (parent: f587b1e)
author | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Sat, 12 Oct 2019 17:49:12 +0000 (20:49 +0300) | ||
committer | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Sat, 12 Oct 2019 17:52:21 +0000 (20:52 +0300) |
src/shared/utils.pas | patch | blob | history |
diff --git a/src/shared/utils.pas b/src/shared/utils.pas
index 215e60a8115bfb5373da9329867f78804a001139..5ef58845df0057b088866ef616bbf1e1f6b3ebcf 100644 (file)
--- a/src/shared/utils.pas
+++ b/src/shared/utils.pas
uses
xstreams;
+const wadExtensions: array [0..6] of AnsiString = (
+ '.dfz',
+ '.wad',
+ '.dfwad',
+ '.pk3',
+ '.pak',
+ '.zip',
+ '.dfzip'
+);
+
// ////////////////////////////////////////////////////////////////////////// //
procedure CopyMemory (Dest: Pointer; Src: Pointer; Len: LongWord); inline;
function hasWadExtension (const fn: AnsiString): Boolean;
var
- ext: AnsiString;
+ ext, newExt: AnsiString;
begin
ext := getFilenameExt(fn);
- result := StrEquCI1251(ext, '.wad') or StrEquCI1251(ext, '.pk3') or StrEquCI1251(ext, '.zip') or StrEquCI1251(ext, '.dfz');
+ result := true;
+ for newExt in wadExtensions do if (StrEquCI1251(ext, newExt)) then exit;
+ result := false;
+ //result := StrEquCI1251(ext, '.wad') or StrEquCI1251(ext, '.pk3') or StrEquCI1251(ext, '.zip') or StrEquCI1251(ext, '.dfz');
end;
if not hasWadExtension(result) then result := result+'.wad';
end;
+
function isWadData (data: Pointer; len: LongWord): Boolean;
var p: PChar;
begin
end;
-const fileExtensions: array [0..6] of AnsiString = ('.dfz', '.wad', '.dfwad', '.pk3', '.pak', '.zip', '.dfzip');
-
function isWadNamesEqu (wna, wnb: AnsiString): Boolean;
var
ext, newExt: AnsiString;
// check first ext
ext := getFilenameExt(wna);
found := false;
- for newExt in fileExtensions do if (StrEquCI1251(ext, newExt)) then begin found := true; break; end;
+ for newExt in wadExtensions do if (StrEquCI1251(ext, newExt)) then begin found := true; break; end;
if not found then exit;
// check second ext
ext := getFilenameExt(wnb);
found := false;
- for newExt in fileExtensions do if (StrEquCI1251(ext, newExt)) then begin found := true; break; end;
+ for newExt in wadExtensions do if (StrEquCI1251(ext, newExt)) then begin found := true; break; end;
if not found then exit;
wna := forceFilenameExt(wna, '');
wnb := forceFilenameExt(wnb, '');
origExt := getFilenameExt(fname);
fname := forceFilenameExt(fname, '');
//writeln(' findDiskWad01: fname=<', fname, '>; origExt=<', origExt, '>');
- for newExt in fileExtensions do
+ for newExt in wadExtensions do
begin
//writeln(' findDiskWad02: fname=<', fname, '>; origExt=<', origExt, '>; newExt=<', newExt, '>');
if (StrEquCI1251(newExt, origExt)) then