Skip to content

Commit

Permalink
Make PDoc::OpenInclude() support absolute paths.
Browse files Browse the repository at this point in the history
This was preventing, for example, Lout's languge addon use of the
"open includes" feature, as it was computing absolute paths that
Pe's code didn't seemed to handle (at least when the files where
not on the same dir as the doc being edited).
  • Loading branch information
OscarL authored and humdinger committed May 15, 2023
1 parent 90098de commit 3826e75
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Sources/PDoc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,17 @@ void PDoc::OpenInclude(const char *incl)
return;
}

// Handle absolute paths
if (strncmp(incl, "/", 1) == 0)
{
BPath path(incl);
if (e.SetTo(path.Path(), true) == B_OK && e.Exists() && e.IsFile())
{
FailOSErr(e.GetRef(&doc));
found = true;
}
}

if (! found && fText->GetCWD())
{
FailOSErr(d.SetTo(fText->GetCWD()));
Expand Down

0 comments on commit 3826e75

Please sign in to comment.