fix #325 - Same module can be opened twice

This commit is contained in:
Basile Burg 2018-05-20 16:23:35 +02:00
parent 2511e5a0a8
commit 76847765fb
1 changed files with 20 additions and 6 deletions

View File

@ -1153,12 +1153,6 @@ begin
((aMessage[i] = '(') or (aMessage[i] = ':') or ((aMessage[i] = '(') or (aMessage[i] = ':') or
((aMessage[i] = '-') and (i < aMessage.length-5) and (aMessage[i..i+5] = '-mixin'))) then ((aMessage[i] = '-') and (i < aMessage.length-5) and (aMessage[i..i+5] = '-mixin'))) then
begin begin
// absolute fname
if ident.fileExists then
begin
getMultiDocHandler.openDocument(ident);
exit(true);
end;
// relative fname if project file is the base path to a rel. fname // relative fname if project file is the base path to a rel. fname
absName := ExpandFileName(ident); absName := ExpandFileName(ident);
if absName.fileExists then if absName.fileExists then
@ -1166,6 +1160,12 @@ begin
getMultiDocHandler.openDocument(absName); getMultiDocHandler.openDocument(absName);
exit(true); exit(true);
end; end;
// absolute fname
if ident.fileExists then
begin
getMultiDocHandler.openDocument(ident);
exit(true);
end;
// if fname relative to project path // if fname relative to project path
if fProj <> nil then if fProj <> nil then
begin begin
@ -1176,6 +1176,20 @@ begin
exit(true); exit(true);
end; end;
end; end;
// finally try using pwd ...
absName := expandFilenameEx(GetCurrentDir, ident);
if absName.fileExists then
begin
getMultiDocHandler.openDocument(absName);
exit(true);
end;
// ... and $HOME
absName := expandFilenameEx(GetUserDir, ident);
if absName.fileExists then
begin
getMultiDocHandler.openDocument(absName);
exit(true);
end;
end end
// <assertion failure messg>@<filename> // <assertion failure messg>@<filename>
else if aMessage[i] = '@' then else if aMessage[i] = '@' then