mirror of https://gitlab.com/basile.b/dexed.git
renamed ce_common member getDocPath
This commit is contained in:
parent
02af01a612
commit
0881fe9cec
|
@ -159,10 +159,15 @@ type
|
||||||
*)
|
*)
|
||||||
function shortenPath(const aPath: string; charThresh: Word = 60): string;
|
function shortenPath(const aPath: string; charThresh: Word = 60): string;
|
||||||
|
|
||||||
|
(**
|
||||||
|
* Returns the user data dir.
|
||||||
|
*)
|
||||||
|
function getUserDocPath: string;
|
||||||
|
|
||||||
(**
|
(**
|
||||||
* Returns the folder Coedit documents and settings.
|
* Returns the folder Coedit documents and settings.
|
||||||
*)
|
*)
|
||||||
function getDocPath: string;
|
function getCoeditDocPath: string;
|
||||||
|
|
||||||
(**
|
(**
|
||||||
* Fills aList with the names of the files located in aPath.
|
* Fills aList with the names of the files located in aPath.
|
||||||
|
@ -574,7 +579,7 @@ begin
|
||||||
exit( format('%s%s...%s',[drv,directorySeparator,pth1]) );
|
exit( format('%s%s...%s',[drv,directorySeparator,pth1]) );
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function getDocPath: string;
|
function getUserDocPath: string;
|
||||||
{$IFDEF WINDOWS}
|
{$IFDEF WINDOWS}
|
||||||
var
|
var
|
||||||
PIDL : PItemIDList;
|
PIDL : PItemIDList;
|
||||||
|
@ -592,7 +597,12 @@ begin
|
||||||
{$IFDEF UNIX}
|
{$IFDEF UNIX}
|
||||||
result := ExpandFileName('~/');
|
result := ExpandFileName('~/');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
result += directorySeparator + 'Coedit' + directorySeparator;
|
result += directorySeparator;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function getCoeditDocPath: string;
|
||||||
|
begin
|
||||||
|
result := getUserDocPath + 'Coedit' + directorySeparator;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function isFolder(sr: TSearchRec): boolean;
|
function isFolder(sr: TSearchRec): boolean;
|
||||||
|
|
|
@ -10,9 +10,9 @@ uses
|
||||||
|
|
||||||
type
|
type
|
||||||
(**
|
(**
|
||||||
* Wrap the dcd-server and dcd-clients processes.
|
* Wrap the dcd-server and dcd-client processes.
|
||||||
*
|
*
|
||||||
* Projects folder are automatically imported: ICEProjectObserver.
|
* Projects folders are automatically imported: ICEProjectObserver.
|
||||||
* Completion, hints and declaration finder automatically work on the current
|
* Completion, hints and declaration finder automatically work on the current
|
||||||
* document: ICEMultiDocObserver.
|
* document: ICEMultiDocObserver.
|
||||||
*)
|
*)
|
||||||
|
|
|
@ -31,6 +31,7 @@ type
|
||||||
private
|
private
|
||||||
fCol: TCollection;
|
fCol: TCollection;
|
||||||
procedure setCol(const aValue: TCollection);
|
procedure setCol(const aValue: TCollection);
|
||||||
|
procedure addDubPackages;
|
||||||
protected
|
protected
|
||||||
procedure afterLoad; override;
|
procedure afterLoad; override;
|
||||||
published
|
published
|
||||||
|
@ -59,14 +60,14 @@ var
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
fCol := TCollection.Create(TLibraryItem);
|
fCol := TCollection.Create(TLibraryItem);
|
||||||
fname := getDocPath + libFname;
|
fname := getCoeditDocPath + libFname;
|
||||||
if fileExists(fname) then loadFromFile(fname);
|
if fileExists(fname) then loadFromFile(fname);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TLibraryManager.destroy;
|
destructor TLibraryManager.destroy;
|
||||||
begin
|
begin
|
||||||
forceDirectory(getDocPath);
|
forceDirectory(getCoeditDocPath);
|
||||||
LibMan.saveToFile(getDocPath + libFname);
|
LibMan.saveToFile(getCoeditDocPath + libFname);
|
||||||
fCol.Free;
|
fCol.Free;
|
||||||
inherited;
|
inherited;
|
||||||
end;
|
end;
|
||||||
|
@ -76,6 +77,27 @@ begin
|
||||||
fCol.assign(aValue);
|
fCol.assign(aValue);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TLibraryManager.addDubPackages;
|
||||||
|
var
|
||||||
|
path: string;
|
||||||
|
begin
|
||||||
|
if not exeInSysPath('dub' + exeExt) then exit;
|
||||||
|
//
|
||||||
|
path := getUserDocPath + 'dub' + DirectorySeparator + 'packages';
|
||||||
|
{
|
||||||
|
get folders
|
||||||
|
foreach folder in folders
|
||||||
|
begin
|
||||||
|
if find src/import/source then
|
||||||
|
add libman entry with this folder (dcd completion, static explorer will use this)
|
||||||
|
if find lib with matching libname then
|
||||||
|
add lib file to the new libman item (runnable module can use it, alias can be specified in project)
|
||||||
|
end
|
||||||
|
|
||||||
|
set the dubpackage entries readonly, since they'll be regenerated for each cession
|
||||||
|
}
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TLibraryManager.updateDCD;
|
procedure TLibraryManager.updateDCD;
|
||||||
var
|
var
|
||||||
itm: TLibraryItem;
|
itm: TLibraryItem;
|
||||||
|
|
|
@ -530,8 +530,8 @@ var
|
||||||
fname2: string;
|
fname2: string;
|
||||||
opts: TCEOptions;
|
opts: TCEOptions;
|
||||||
begin
|
begin
|
||||||
fname1 := getDocPath + 'options2.txt';
|
fname1 := getCoeditDocPath + 'options2.txt';
|
||||||
fname2 := getDocPath + 'options2.bak';
|
fname2 := getCoeditDocPath + 'options2.bak';
|
||||||
opts := TCEOptions.create(nil);
|
opts := TCEOptions.create(nil);
|
||||||
try
|
try
|
||||||
if fileExists(fname1) then
|
if fileExists(fname1) then
|
||||||
|
@ -558,8 +558,8 @@ begin
|
||||||
exit;
|
exit;
|
||||||
opts := TCEOptions.create(nil);
|
opts := TCEOptions.create(nil);
|
||||||
try
|
try
|
||||||
forceDirectory(getDocPath);
|
forceDirectory(getCoeditDocPath);
|
||||||
opts.saveToFile(getDocPath + 'options2.txt');
|
opts.saveToFile(getCoeditDocPath + 'options2.txt');
|
||||||
finally
|
finally
|
||||||
opts.Free;
|
opts.Free;
|
||||||
end;
|
end;
|
||||||
|
@ -581,8 +581,8 @@ begin
|
||||||
end;
|
end;
|
||||||
if not Visible then exit;
|
if not Visible then exit;
|
||||||
//
|
//
|
||||||
forceDirectory(getDocPath);
|
forceDirectory(getCoeditDocPath);
|
||||||
xcfg := TXMLConfigStorage.Create(getDocPath + 'docking.xml',false);
|
xcfg := TXMLConfigStorage.Create(getCoeditDocPath + 'docking.xml',false);
|
||||||
try
|
try
|
||||||
DockMaster.SaveLayoutToConfig(xcfg);
|
DockMaster.SaveLayoutToConfig(xcfg);
|
||||||
xcfg.WriteToDisk;
|
xcfg.WriteToDisk;
|
||||||
|
@ -590,7 +590,7 @@ begin
|
||||||
xcfg.Free;
|
xcfg.Free;
|
||||||
end;
|
end;
|
||||||
//
|
//
|
||||||
xcfg := TXMLConfigStorage.Create(getDocPath + 'dockingopts.xml',false);
|
xcfg := TXMLConfigStorage.Create(getCoeditDocPath + 'dockingopts.xml',false);
|
||||||
try
|
try
|
||||||
DockMaster.SaveSettingsToConfig(xcfg);
|
DockMaster.SaveSettingsToConfig(xcfg);
|
||||||
xcfg.WriteToDisk;
|
xcfg.WriteToDisk;
|
||||||
|
@ -604,9 +604,9 @@ var
|
||||||
xcfg: TXMLConfigStorage;
|
xcfg: TXMLConfigStorage;
|
||||||
str: TMemoryStream;
|
str: TMemoryStream;
|
||||||
begin
|
begin
|
||||||
if fileExists(getDocPath + 'docking.xml') then
|
if fileExists(getCoeditDocPath + 'docking.xml') then
|
||||||
begin
|
begin
|
||||||
xcfg := TXMLConfigStorage.Create(getDocPath + 'docking.xml', true);
|
xcfg := TXMLConfigStorage.Create(getCoeditDocPath + 'docking.xml', true);
|
||||||
try
|
try
|
||||||
try
|
try
|
||||||
DockMaster.LoadLayoutFromConfig(xcfg, false);
|
DockMaster.LoadLayoutFromConfig(xcfg, false);
|
||||||
|
@ -616,7 +616,7 @@ begin
|
||||||
str := TMemoryStream.Create;
|
str := TMemoryStream.Create;
|
||||||
try
|
try
|
||||||
xcfg.SaveToStream(str);
|
xcfg.SaveToStream(str);
|
||||||
str.saveToFile(getDocPath + 'docking.bak')
|
str.saveToFile(getCoeditDocPath + 'docking.bak')
|
||||||
finally
|
finally
|
||||||
str.Free;
|
str.Free;
|
||||||
end;
|
end;
|
||||||
|
@ -624,9 +624,9 @@ begin
|
||||||
xcfg.Free;
|
xcfg.Free;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
if fileExists(getDocPath + 'dockingopts.xml') then
|
if fileExists(getCoeditDocPath + 'dockingopts.xml') then
|
||||||
begin
|
begin
|
||||||
xcfg := TXMLConfigStorage.Create(getDocPath + 'dockingopts.xml', true);
|
xcfg := TXMLConfigStorage.Create(getCoeditDocPath + 'dockingopts.xml', true);
|
||||||
try
|
try
|
||||||
try
|
try
|
||||||
DockMaster.LoadSettingsFromConfig(xcfg);
|
DockMaster.LoadSettingsFromConfig(xcfg);
|
||||||
|
@ -636,7 +636,7 @@ begin
|
||||||
str := TMemoryStream.Create;
|
str := TMemoryStream.Create;
|
||||||
try
|
try
|
||||||
xcfg.SaveToStream(str);
|
xcfg.SaveToStream(str);
|
||||||
str.saveToFile(getDocPath + 'dockingopts.bak')
|
str.saveToFile(getCoeditDocPath + 'dockingopts.bak')
|
||||||
finally
|
finally
|
||||||
str.Free;
|
str.Free;
|
||||||
end;
|
end;
|
||||||
|
@ -1523,7 +1523,7 @@ begin
|
||||||
//
|
//
|
||||||
lst := TStringList.Create;
|
lst := TStringList.Create;
|
||||||
try
|
try
|
||||||
listFiles(lst, getDocPath + 'layouts' + DirectorySeparator);
|
listFiles(lst, getCoeditDocPath + 'layouts' + DirectorySeparator);
|
||||||
for i := 0 to lst.Count-1 do
|
for i := 0 to lst.Count-1 do
|
||||||
begin
|
begin
|
||||||
itm := TMenuItem.Create(self);
|
itm := TMenuItem.Create(self);
|
||||||
|
@ -1540,7 +1540,7 @@ end;
|
||||||
|
|
||||||
procedure TCEMainForm.layoutMnuItemClick(sender: TObject);
|
procedure TCEMainForm.layoutMnuItemClick(sender: TObject);
|
||||||
begin
|
begin
|
||||||
layoutLoadFromFile(getDocPath + 'layouts' + DirectorySeparator +
|
layoutLoadFromFile(getCoeditDocPath + 'layouts' + DirectorySeparator +
|
||||||
TMenuItem(sender).Caption + '.xml');
|
TMenuItem(sender).Caption + '.xml');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -1555,7 +1555,7 @@ begin
|
||||||
fname := extractFileName(fname);
|
fname := extractFileName(fname);
|
||||||
if extractFileExt(fname) <> '.xml' then
|
if extractFileExt(fname) <> '.xml' then
|
||||||
fname += '.xml';
|
fname += '.xml';
|
||||||
layoutSaveToFile(getDocPath + 'layouts' + DirectorySeparator + fname);
|
layoutSaveToFile(getCoeditDocPath + 'layouts' + DirectorySeparator + fname);
|
||||||
layoutUpdateMenu;
|
layoutUpdateMenu;
|
||||||
end;
|
end;
|
||||||
{$ENDREGION}
|
{$ENDREGION}
|
||||||
|
|
|
@ -82,7 +82,7 @@ begin
|
||||||
fMacros.Delimiter := '=';
|
fMacros.Delimiter := '=';
|
||||||
assert(fCompletor.ShortCut <> 0);
|
assert(fCompletor.ShortCut <> 0);
|
||||||
//
|
//
|
||||||
fname := getDocPath + macFname;
|
fname := getCoeditDocPath + macFname;
|
||||||
if fileExists(fname) then loadFromFile(fname);
|
if fileExists(fname) then loadFromFile(fname);
|
||||||
addDefaults;
|
addDefaults;
|
||||||
//
|
//
|
||||||
|
@ -94,7 +94,7 @@ end;
|
||||||
|
|
||||||
destructor TCEStaticEditorMacro.destroy;
|
destructor TCEStaticEditorMacro.destroy;
|
||||||
begin
|
begin
|
||||||
saveToFile(getDocPath + macFname);
|
saveToFile(getCoeditDocPath + macFname);
|
||||||
EntitiesConnector.removeObserver(Self);
|
EntitiesConnector.removeObserver(Self);
|
||||||
//
|
//
|
||||||
fMacros.Free;
|
fMacros.Free;
|
||||||
|
|
|
@ -203,7 +203,7 @@ begin
|
||||||
tempn := fMemo.fileName;
|
tempn := fMemo.fileName;
|
||||||
if not fileExists(tempn) then exit;
|
if not fileExists(tempn) then exit;
|
||||||
//
|
//
|
||||||
fname := getDocPath + 'editorcache' + DirectorySeparator;
|
fname := getCoeditDocPath + 'editorcache' + DirectorySeparator;
|
||||||
ForceDirectories(fname);
|
ForceDirectories(fname);
|
||||||
chksm := crc32(0, nil, 0);
|
chksm := crc32(0, nil, 0);
|
||||||
chksm := crc32(chksm, @tempn[1], length(tempn));
|
chksm := crc32(chksm, @tempn[1], length(tempn));
|
||||||
|
@ -220,7 +220,7 @@ begin
|
||||||
tempn := fMemo.fileName;
|
tempn := fMemo.fileName;
|
||||||
if not fileExists(tempn) then exit;
|
if not fileExists(tempn) then exit;
|
||||||
//
|
//
|
||||||
fname := getDocPath + 'editorcache' + DirectorySeparator;
|
fname := getCoeditDocPath + 'editorcache' + DirectorySeparator;
|
||||||
chksm := crc32(0, nil, 0);
|
chksm := crc32(0, nil, 0);
|
||||||
chksm := crc32(chksm, @tempn[1], length(tempn));
|
chksm := crc32(chksm, @tempn[1], length(tempn));
|
||||||
fname := fname + format('%.8X.txt', [chksm]);
|
fname := fname + format('%.8X.txt', [chksm]);
|
||||||
|
|
|
@ -137,7 +137,7 @@ var
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
fTools := TCollection.Create(TCEToolItem);
|
fTools := TCollection.Create(TCEToolItem);
|
||||||
fname := getDocPath + toolsFname;
|
fname := getCoeditDocPath + toolsFname;
|
||||||
if fileExists(fname) then loadFromFile(fname);
|
if fileExists(fname) then loadFromFile(fname);
|
||||||
//
|
//
|
||||||
EntitiesConnector.addObserver(self);
|
EntitiesConnector.addObserver(self);
|
||||||
|
@ -147,8 +147,8 @@ destructor TCETools.destroy;
|
||||||
begin
|
begin
|
||||||
EntitiesConnector.removeObserver(self);
|
EntitiesConnector.removeObserver(self);
|
||||||
//
|
//
|
||||||
forceDirectory(getDocPath);
|
forceDirectory(getCoeditDocPath);
|
||||||
saveToFile(getDocPath + toolsFname);
|
saveToFile(getCoeditDocPath + toolsFname);
|
||||||
fTools.Free;
|
fTools.Free;
|
||||||
inherited;
|
inherited;
|
||||||
end;
|
end;
|
||||||
|
|
Loading…
Reference in New Issue