mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2025-04-19 08:12:14 +00:00
Fix idParser::Directive_include() to properly handle full os path as fetched by idLexer::GetFileName()
This commit is contained in:
parent
1c4883354b
commit
7485a123f6
1 changed files with 11 additions and 4 deletions
|
@ -1150,11 +1150,18 @@ int idParser::Directive_include( idToken* token, bool supressWarning )
|
|||
// try relative to the current file
|
||||
path = scriptstack->GetFileName();
|
||||
path.StripFilename();
|
||||
path += "/";
|
||||
path += *token;
|
||||
if( !script->LoadFile( path, OSPath ) )
|
||||
// first remove any trailing path overlap with token
|
||||
idStr token_path = *token;
|
||||
if( !path.StripTrailingOnce( token_path.StripFilename() ) )
|
||||
{
|
||||
// try absolute path
|
||||
// if no path overlap add separator before token
|
||||
path += "/";
|
||||
}
|
||||
path += *token;
|
||||
// try assuming a full os path from GetFileName()
|
||||
if( !script->LoadFile( path, true ) )
|
||||
{
|
||||
// try from the token path
|
||||
path = *token;
|
||||
if( !script->LoadFile( path, OSPath ) )
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue