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;
|
||||
|
||||
procedure TCENativeProject.customLoadFromFile(const fname: string);
|
||||
var
|
||||
f: string;
|
||||
begin
|
||||
fbasePath := fname.extractFilePath;
|
||||
inherited customLoadFromFile(fname);
|
||||
f := fname;
|
||||
if not FilenameIsAbsolute(f) then
|
||||
f := ExpandFileName(f);
|
||||
fbasePath := f.extractFilePath;
|
||||
inherited customLoadFromFile(f);
|
||||
end;
|
||||
|
||||
procedure TCENativeProject.customSaveToFile(const fname: string);
|
||||
|
@ -1090,7 +1095,7 @@ var
|
|||
fname: string;
|
||||
begin
|
||||
fname := fSrcs[index];
|
||||
if fname.fileExists then
|
||||
if FilenameIsAbsolute(fname) then
|
||||
result := fname
|
||||
else
|
||||
result := expandFilenameEx(fBasePath, fname);
|
||||
|
|
|
@ -630,6 +630,8 @@ function expandFilenameEx(const basePath, fname: string): string;
|
|||
var
|
||||
curr: string = '';
|
||||
begin
|
||||
if FilenameIsAbsolute(fname) then
|
||||
exit(fname);
|
||||
getDir(0, curr);
|
||||
try
|
||||
if (curr <> basePath) and basePath.dirExists then
|
||||
|
|
|
@ -744,9 +744,11 @@ var
|
|||
ext: string;
|
||||
bom: dword = 0;
|
||||
begin
|
||||
ext := fname.extractFileExt.upperCase;
|
||||
fBasePath := fname.extractFilePath;
|
||||
fFilename := fname;
|
||||
if not FilenameIsAbsolute(fFilename) then
|
||||
fFilename := ExpandFileName(fFilename);
|
||||
ext := fFilename.extractFileExt.upperCase;
|
||||
fBasePath := fFilename.extractFilePath;
|
||||
fSaveAsUtf8 := false;
|
||||
fIsSdl := false;
|
||||
if ext = '.JSON' then
|
||||
|
@ -897,7 +899,7 @@ var
|
|||
fname: string;
|
||||
begin
|
||||
fname := fSrcs[index];
|
||||
if fname.fileExists then
|
||||
if FilenameIsAbsolute(fname) then
|
||||
result := fname
|
||||
else
|
||||
result := expandFilenameEx(fBasePath, fname);
|
||||
|
|
|
@ -7,7 +7,7 @@ interface
|
|||
uses
|
||||
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, ComCtrls,
|
||||
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_observer, ce_sharedres, ce_stringrange, ce_dsgncontrols;
|
||||
|
||||
|
@ -1171,7 +1171,7 @@ begin
|
|||
exit(true);
|
||||
end;
|
||||
// absolute fname
|
||||
if ident.fileExists then
|
||||
if FilenameIsAbsolute(ident) then
|
||||
begin
|
||||
getMultiDocHandler.openDocument(ident);
|
||||
exit(true);
|
||||
|
|
|
@ -3217,10 +3217,11 @@ begin
|
|||
else
|
||||
Highlighter := TxtSyn;
|
||||
end;
|
||||
Lines.LoadFromFile(fname);
|
||||
fFilename := fname;
|
||||
if not FilenameIsAbsolute(fFilename) then
|
||||
fFilename := ExpandFileName(fFilename);
|
||||
Lines.LoadFromFile(fname);
|
||||
FileAge(fFilename, fFileDate);
|
||||
|
||||
fModified := false;
|
||||
if Showing then
|
||||
begin
|
||||
|
|
Loading…
Reference in New Issue