summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 955bce5)
raw | patch | inline | side by side (parent: 955bce5)
author | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Fri, 8 Apr 2016 01:36:52 +0000 (04:36 +0300) | ||
committer | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Fri, 8 Apr 2016 01:36:52 +0000 (04:36 +0300) |
src/shared/WADEDITOR.pas | patch | blob | history |
index 0c3357b58c6cf7f37df37ca984c69ddc402f4da7..54706cfd2df180486d587038f6976070945d732c 100644 (file)
--- a/src/shared/WADEDITOR.pas
+++ b/src/shared/WADEDITOR.pas
end;
+function removeExt (s: string): string;
+var
+ i: Integer;
+begin
+ i := length(s)+1;
+ while (i > 1) and (s[i-1] <> '.') and (s[i-1] <> '/') do Dec(i);
+ if (i > 1) and (s[i-1] = '.') then
+ begin
+ //writeln('[', s, '] -> [', Copy(s, 1, i-2), ']');
+ s := Copy(s, 1, i-2);
+ end;
+ result := s;
+end;
+
function TWADEditor_1.GetResource (Section, Resource: string; var pData: Pointer; var Len: Integer): Boolean;
var
f: Integer;
fi := fIter.Files[f];
if fi = nil then continue;
//e_WriteLog(Format('DFWAD: searching for [%s : %s] in [%s]; current is [%s : %s] (%d, %d)', [Section, Resource, fFileName, fi.path, fi.name, SFSStrEqu(fi.path, Section), SFSStrEqu(fi.name, Resource)]), MSG_NOTIFY);
- if {SFSStrEqu}SFSDFPathEqu(fi.path, Section) and SFSStrEqu(fi.name, Resource) then
+ if {SFSStrEqu}SFSDFPathEqu(fi.path, Section) and SFSStrEqu(removeExt(fi.name), Resource) then
begin
// i found her!
//fn := fFileName+'::'+fi.path+fi.name;
if {SFSStrEqu}SFSDFPathEqu(fi.path, Section) then
begin
SetLength(result, Length(result)+1);
- result[high(result)] := fi.name;
+ result[high(result)] := removeExt(fi.name);
end;
end;
end;