mirror of https://gitlab.com/basile.b/dexed.git
fix #380 - Same module can still be opened twice
This commit is contained in:
parent
7d9c394a74
commit
5df157a62c
|
@ -265,9 +265,14 @@ begin
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCENativeProject.customLoadFromFile(const fname: string);
|
procedure TCENativeProject.customLoadFromFile(const fname: string);
|
||||||
|
var
|
||||||
|
f: string;
|
||||||
begin
|
begin
|
||||||
fbasePath := fname.extractFilePath;
|
f := fname;
|
||||||
inherited customLoadFromFile(fname);
|
if not FilenameIsAbsolute(f) then
|
||||||
|
f := ExpandFileName(f);
|
||||||
|
fbasePath := f.extractFilePath;
|
||||||
|
inherited customLoadFromFile(f);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCENativeProject.customSaveToFile(const fname: string);
|
procedure TCENativeProject.customSaveToFile(const fname: string);
|
||||||
|
@ -1090,7 +1095,7 @@ var
|
||||||
fname: string;
|
fname: string;
|
||||||
begin
|
begin
|
||||||
fname := fSrcs[index];
|
fname := fSrcs[index];
|
||||||
if fname.fileExists then
|
if FilenameIsAbsolute(fname) then
|
||||||
result := fname
|
result := fname
|
||||||
else
|
else
|
||||||
result := expandFilenameEx(fBasePath, fname);
|
result := expandFilenameEx(fBasePath, fname);
|
||||||
|
|
|
@ -630,6 +630,8 @@ function expandFilenameEx(const basePath, fname: string): string;
|
||||||
var
|
var
|
||||||
curr: string = '';
|
curr: string = '';
|
||||||
begin
|
begin
|
||||||
|
if FilenameIsAbsolute(fname) then
|
||||||
|
exit(fname);
|
||||||
getDir(0, curr);
|
getDir(0, curr);
|
||||||
try
|
try
|
||||||
if (curr <> basePath) and basePath.dirExists then
|
if (curr <> basePath) and basePath.dirExists then
|
||||||
|
|
|
@ -744,9 +744,11 @@ var
|
||||||
ext: string;
|
ext: string;
|
||||||
bom: dword = 0;
|
bom: dword = 0;
|
||||||
begin
|
begin
|
||||||
ext := fname.extractFileExt.upperCase;
|
|
||||||
fBasePath := fname.extractFilePath;
|
|
||||||
fFilename := fname;
|
fFilename := fname;
|
||||||
|
if not FilenameIsAbsolute(fFilename) then
|
||||||
|
fFilename := ExpandFileName(fFilename);
|
||||||
|
ext := fFilename.extractFileExt.upperCase;
|
||||||
|
fBasePath := fFilename.extractFilePath;
|
||||||
fSaveAsUtf8 := false;
|
fSaveAsUtf8 := false;
|
||||||
fIsSdl := false;
|
fIsSdl := false;
|
||||||
if ext = '.JSON' then
|
if ext = '.JSON' then
|
||||||
|
@ -897,7 +899,7 @@ var
|
||||||
fname: string;
|
fname: string;
|
||||||
begin
|
begin
|
||||||
fname := fSrcs[index];
|
fname := fSrcs[index];
|
||||||
if fname.fileExists then
|
if FilenameIsAbsolute(fname) then
|
||||||
result := fname
|
result := fname
|
||||||
else
|
else
|
||||||
result := expandFilenameEx(fBasePath, fname);
|
result := expandFilenameEx(fBasePath, fname);
|
||||||
|
|
|
@ -7,7 +7,7 @@ interface
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, ComCtrls,
|
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, ComCtrls,
|
||||||
EditBtn, lcltype, ce_widget, ActnList, Menus, clipbrd, AnchorDocking, math,
|
EditBtn, lcltype, ce_widget, ActnList, Menus, clipbrd, AnchorDocking, math,
|
||||||
TreeFilterEdit, Buttons, GraphType, fgl, strutils,
|
TreeFilterEdit, Buttons, GraphType, fgl, strutils, LazFileUtils,
|
||||||
ce_ddemangle, ce_writableComponent, ce_common, ce_synmemo, ce_interfaces,
|
ce_ddemangle, ce_writableComponent, ce_common, ce_synmemo, ce_interfaces,
|
||||||
ce_observer, ce_sharedres, ce_stringrange, ce_dsgncontrols;
|
ce_observer, ce_sharedres, ce_stringrange, ce_dsgncontrols;
|
||||||
|
|
||||||
|
@ -1171,7 +1171,7 @@ begin
|
||||||
exit(true);
|
exit(true);
|
||||||
end;
|
end;
|
||||||
// absolute fname
|
// absolute fname
|
||||||
if ident.fileExists then
|
if FilenameIsAbsolute(ident) then
|
||||||
begin
|
begin
|
||||||
getMultiDocHandler.openDocument(ident);
|
getMultiDocHandler.openDocument(ident);
|
||||||
exit(true);
|
exit(true);
|
||||||
|
|
|
@ -3217,10 +3217,11 @@ begin
|
||||||
else
|
else
|
||||||
Highlighter := TxtSyn;
|
Highlighter := TxtSyn;
|
||||||
end;
|
end;
|
||||||
Lines.LoadFromFile(fname);
|
|
||||||
fFilename := fname;
|
fFilename := fname;
|
||||||
|
if not FilenameIsAbsolute(fFilename) then
|
||||||
|
fFilename := ExpandFileName(fFilename);
|
||||||
|
Lines.LoadFromFile(fname);
|
||||||
FileAge(fFilename, fFileDate);
|
FileAge(fFilename, fFileDate);
|
||||||
|
|
||||||
fModified := false;
|
fModified := false;
|
||||||
if Showing then
|
if Showing then
|
||||||
begin
|
begin
|
||||||
|
|
Loading…
Reference in New Issue