X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fshared%2FWADEDITOR.pas;h=54706cfd2df180486d587038f6976070945d732c;hb=fc715be74194fb63ae846d2972dab82ebf589b99;hp=0c3357b58c6cf7f37df37ca984c69ddc402f4da7;hpb=955bce518d1ce6de18133b8ee19a6436aef174cd;p=d2df-sdl.git diff --git a/src/shared/WADEDITOR.pas b/src/shared/WADEDITOR.pas index 0c3357b..54706cf 100644 --- a/src/shared/WADEDITOR.pas +++ b/src/shared/WADEDITOR.pas @@ -138,6 +138,20 @@ begin 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; @@ -154,7 +168,7 @@ begin 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; @@ -201,7 +215,7 @@ begin 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;