mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
ADD: Store configuration files in the 'settings' subdirectory (portable mode)
This commit is contained in:
parent
e361d26216
commit
b4ad423371
11 changed files with 69 additions and 19 deletions
|
|
@ -38,8 +38,6 @@ cp -r doublecmd.app/* $DC_APP_DIR/
|
|||
cp -a doublecmd $DC_INSTALL_DIR/
|
||||
cp -a doublecmd.help $DC_INSTALL_DIR/
|
||||
cp -a doublecmd.zdli $DC_INSTALL_DIR/
|
||||
cp -a pixmaps.txt $DC_INSTALL_DIR/
|
||||
cp -a multiarc.ini $DC_INSTALL_DIR/
|
||||
cp -a pinyin.tbl $DC_INSTALL_DIR/
|
||||
|
||||
# Copy plugins
|
||||
|
|
@ -77,6 +75,7 @@ cp -a scripts/terminal.sh $DC_INSTALL_DIR/scripts/
|
|||
# Copy directories
|
||||
cp -r language $DC_INSTALL_DIR/
|
||||
cp -r pixmaps $DC_INSTALL_DIR/
|
||||
cp -r settings $DC_INSTALL_DIR/
|
||||
cp -r highlighters $DC_INSTALL_DIR/
|
||||
|
||||
# Copy libraries
|
||||
|
|
|
|||
|
|
@ -73,10 +73,11 @@ mkdir -p $DC_INSTALL_DIR/plugins/dsx/dsxlocate
|
|||
cp -a doublecmd $DC_INSTALL_DIR/
|
||||
cp -a doublecmd.help $DC_INSTALL_DIR/
|
||||
cp -a doublecmd.zdli $DC_INSTALL_DIR/
|
||||
cp -a pixmaps.txt $DC_INSTALL_DIR/
|
||||
cp -a multiarc.ini $DC_INSTALL_DIR/
|
||||
cp -a pinyin.tbl $DC_INSTALL_DIR/
|
||||
|
||||
# Copy default settings
|
||||
cp -r settings $DC_INSTALL_DIR/
|
||||
|
||||
# copy plugins
|
||||
# WCX
|
||||
install -m 644 plugins/wcx/base64/base64.wcx $DC_INSTALL_DIR/plugins/wcx/base64/
|
||||
|
|
@ -145,7 +146,7 @@ if [ -z $CK_PORTABLE ]
|
|||
install -m 644 install/linux/org.doublecmd.root.policy $DC_INSTALL_PREFIX/usr/share/polkit-1/actions/
|
||||
else
|
||||
# Make portable version
|
||||
touch $DC_INSTALL_DIR/doublecmd.inf
|
||||
touch $DC_INSTALL_DIR/settings/doublecmd.inf
|
||||
# Copy documentation
|
||||
mkdir -p $DC_INSTALL_DIR/doc
|
||||
cp -a doc/*.txt $DC_INSTALL_DIR/doc/
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ copy ..\..\src\doublecmd.ico %BUILD_PACK_DIR%\
|
|||
|
||||
pushd %BUILD_PACK_DIR%
|
||||
|
||||
del /Q doublecmd\doublecmd.inf
|
||||
del /Q doublecmd\settings\doublecmd.inf
|
||||
move doublecmd "Double Commander"
|
||||
heat dir "Double Commander" -ag -cg HeatGroup -dr %PF% -var var.SourcePath -o include.wxs
|
||||
candle -arch %CPU_TARGET% -dProductVersion=%DC_VER% -dSourcePath="Double Commander" -dProgramFiles=%PF% doublecmd.wxs include.wxs
|
||||
|
|
|
|||
|
|
@ -58,8 +58,8 @@ Source: "doublecmd\doublecmd.help"; DestDir: "{app}"
|
|||
Source: "doublecmd\doublecmd.exe"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "doublecmd\doublecmd.zdli"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "doublecmd\pinyin.tbl"; DestDir: "{app}"; Flags: onlyifdoesntexist
|
||||
Source: "doublecmd\pixmaps.txt"; DestDir: "{app}"; Flags: onlyifdoesntexist
|
||||
Source: "doublecmd\multiarc.ini"; DestDir: "{app}"; Flags: onlyifdoesntexist
|
||||
Source: "doublecmd\settings\pixmaps.txt"; DestDir: "{app}\settings"; Flags: onlyifdoesntexist createallsubdirs
|
||||
Source: "doublecmd\settings\multiarc.ini"; DestDir: "{app}\settings"; Flags: onlyifdoesntexist createallsubdirs
|
||||
Source: "doublecmd\doublecmd.visualelementsmanifest.xml"; DestDir: "{app}"; Flags: onlyifdoesntexist
|
||||
Source: "doublecmd\doc\*"; DestDir: "{app}\doc"; Flags: ignoreversion recursesubdirs createallsubdirs
|
||||
Source: "doublecmd\language\*"; DestDir: "{app}\language"; Flags: ignoreversion recursesubdirs createallsubdirs
|
||||
|
|
|
|||
|
|
@ -33,14 +33,13 @@ mkdir %DC_INSTALL_DIR%\doc
|
|||
rem Copy directories
|
||||
xcopy /E language %DC_INSTALL_DIR%\language\
|
||||
xcopy /E pixmaps %DC_INSTALL_DIR%\pixmaps\
|
||||
xcopy /E settings %DC_INSTALL_DIR%\settings\
|
||||
xcopy /E highlighters %DC_INSTALL_DIR%\highlighters\
|
||||
rem Copy files
|
||||
copy doc\*.txt %DC_INSTALL_DIR%\doc\
|
||||
copy doublecmd.exe %DC_INSTALL_DIR%\
|
||||
copy doublecmd.help %DC_INSTALL_DIR%\
|
||||
copy doublecmd.zdli %DC_INSTALL_DIR%\
|
||||
copy pixmaps.txt %DC_INSTALL_DIR%\
|
||||
copy multiarc.ini %DC_INSTALL_DIR%\
|
||||
copy pinyin.tbl %DC_INSTALL_DIR%\
|
||||
rem Copy libraries
|
||||
copy *.dll %DC_INSTALL_DIR%\
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ uses
|
|||
uQt5Workaround,
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
uMoveConfig,
|
||||
uEarlyConfig,
|
||||
DCConvertEncoding,
|
||||
{$IF DEFINED(LCLWIN32) and DEFINED(DARKWIN)}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ procedure SaveEarlyConfig;
|
|||
implementation
|
||||
|
||||
uses
|
||||
DCOSUtils, DCStrUtils, DCClassesUtf8, uSysFolders;
|
||||
DCOSUtils, DCStrUtils, DCClassesUtf8, uSysFolders, uGlobsPaths;
|
||||
|
||||
var
|
||||
AConfig: String;
|
||||
|
|
@ -36,9 +36,8 @@ begin
|
|||
Exit;
|
||||
end;
|
||||
end;
|
||||
Result:= ExtractFilePath(ParamStr(0));
|
||||
if mbFileExists(Result + ApplicationName + '.inf') then
|
||||
Result:= Result + ApplicationName + ConfigExtension
|
||||
if mbFileExists(gpGlobalCfgDir + ApplicationName + '.inf') then
|
||||
Result:= gpGlobalCfgDir + ApplicationName + ConfigExtension
|
||||
else begin
|
||||
Result:= IncludeTrailingBackslash(GetAppConfigDir) + ApplicationName + ConfigExtension;
|
||||
end;
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ procedure UpdateEnvironmentVariable;
|
|||
implementation
|
||||
|
||||
uses
|
||||
SysUtils, LazFileUtils, uDebug, uOSUtils, DCOSUtils, DCStrUtils, uSysFolders;
|
||||
SysUtils, LazFileUtils, uDebug, DCOSUtils, DCStrUtils, uSysFolders;
|
||||
|
||||
function GetAppName : String;
|
||||
begin
|
||||
|
|
@ -37,10 +37,7 @@ end;
|
|||
procedure LoadPaths;
|
||||
begin
|
||||
OnGetApplicationName := @GetAppName;
|
||||
gpExePath := ExtractFilePath(TryReadAllLinks(ParamStrU(0)));
|
||||
DCDebug('Executable directory: ', gpExePath);
|
||||
|
||||
gpGlobalCfgDir := gpExePath;
|
||||
|
||||
if gpCmdLineCfgDir <> EmptyStr then
|
||||
begin
|
||||
if GetPathType(gpCmdLineCfgDir) <> ptAbsolute then
|
||||
|
|
@ -58,6 +55,9 @@ begin
|
|||
gpCfgDir := gpGlobalCfgDir;
|
||||
end;
|
||||
end;
|
||||
DCDebug('Executable directory: ', gpExePath);
|
||||
DCDebug('Configuration directory: ', gpCfgDir);
|
||||
DCDebug('Global configuration directory: ', gpGlobalCfgDir);
|
||||
|
||||
gpCfgDir := IncludeTrailingPathDelimiter(gpCfgDir);
|
||||
gpLngDir := gpExePath + 'language' + DirectorySeparator;
|
||||
|
|
@ -71,4 +71,13 @@ begin
|
|||
mbSetEnvironmentVariable('COMMANDER_PATH', ExcludeTrailingBackslash(gpExePath));
|
||||
end;
|
||||
|
||||
procedure Initialize;
|
||||
begin
|
||||
gpExePath := ExtractFilePath(TryReadAllLinks(ParamStr(0)));
|
||||
gpGlobalCfgDir := gpExePath + 'settings' + DirectorySeparator;
|
||||
end;
|
||||
|
||||
initialization
|
||||
Initialize;
|
||||
|
||||
end.
|
||||
|
|
|
|||
42
src/umoveconfig.pas
Normal file
42
src/umoveconfig.pas
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
unit uMoveConfig;
|
||||
|
||||
{$mode ObjFPC}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, DCOSUtils, uGlobsPaths;
|
||||
|
||||
implementation
|
||||
|
||||
procedure Initialize;
|
||||
var
|
||||
Index: Integer;
|
||||
AFileName: String;
|
||||
AList: TStringList;
|
||||
begin
|
||||
// Double Commander Portable
|
||||
// Move settings from executable directory to 'settings' subdirectory
|
||||
if mbFileExists(gpExePath + 'doublecmd.inf') then
|
||||
begin
|
||||
if mbCreateDir(ExcludeTrailingBackslash(gpGlobalCfgDir)) then
|
||||
begin
|
||||
AList:= FindAllFiles(gpExePath, '*.cache;*.cfg;*.err;*.json;*.inf;*.ini;*.scf;*.txt;*.xml');
|
||||
for Index:= 0 to AList.Count - 1 do
|
||||
begin
|
||||
AFileName:= ExtractFileName(AList[Index]);
|
||||
if (AFileName <> 'dcupdater.ini') and (AFileName <> 'doublecmd.visualelementsmanifest.xml') then
|
||||
begin
|
||||
mbRenameFile(gpExePath + AFileName, gpGlobalCfgDir + AFileName);
|
||||
end;
|
||||
end;
|
||||
AList.Free;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
initialization
|
||||
Initialize;
|
||||
|
||||
end.
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue