From 9ee7f4daabb9d8d5ec4eb33b82fdd9eeff049933 Mon Sep 17 00:00:00 2001 From: Basile Burg Date: Tue, 12 May 2020 22:06:21 +0200 Subject: [PATCH] fix #40 - allow detection of filename for errors messages when building dmd --- src/u_messages.pas | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/u_messages.pas b/src/u_messages.pas index 11c83eab..70aba0bc 100644 --- a/src/u_messages.pas +++ b/src/u_messages.pas @@ -1239,6 +1239,9 @@ var i: integer = 0; ident: string = ''; absName: string; + nsr: string; +const + nonStandardRoot: array [0..3] of string = ('src', 'source', 'sources', 'import'); begin result := false; while (true) do @@ -1265,15 +1268,25 @@ begin getMultiDocHandler.openDocument(ident); exit(true); end; - // if fname relative to project path if fProj <> nil then begin + // if fname relative to project path absName := expandFilenameEx(fProj.filename.extractFileDir + DirectorySeparator, ident); if absName.fileExists then begin getMultiDocHandler.openDocument(absName); exit(true); end; + for nsr in nonStandardRoot do + begin + // if fname is relative to / + absName := expandFilenameEx(fProj.filename.extractFileDir + DirectorySeparator + nsr + DirectorySeparator, ident); + if absName.fileExists then + begin + getMultiDocHandler.openDocument(absName); + exit(true); + end; + end; end; // finally try using pwd ... absName := expandFilenameEx(GetCurrentDir, ident);