From 3826e75741720184ed03088856b22b35db5bda78 Mon Sep 17 00:00:00 2001 From: Oscar Lesta Date: Wed, 26 Apr 2023 19:29:48 -0300 Subject: [PATCH] Make PDoc::OpenInclude() support absolute paths. 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). --- Sources/PDoc.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Sources/PDoc.cpp b/Sources/PDoc.cpp index 58c6cea..df1dc27 100644 --- a/Sources/PDoc.cpp +++ b/Sources/PDoc.cpp @@ -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()));