mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
UPD: Store default configuration files in the separate directory
This commit is contained in:
parent
1c562093ed
commit
1c74b5ebad
8 changed files with 40 additions and 73 deletions
|
|
@ -64,7 +64,8 @@ rem Move created package
|
|||
move release\*.exe %PACK_DIR%
|
||||
|
||||
rem Create *.zip package
|
||||
copy NUL doublecmd\doublecmd.inf
|
||||
mkdir doublecmd\settings
|
||||
copy NUL doublecmd\settings\doublecmd.inf
|
||||
zip -9 -Dr %PACK_DIR%\doublecmd-%DC_VER%.%CPU_TARGET%-%OS_TARGET%.zip doublecmd
|
||||
|
||||
rem Clean temp directories
|
||||
|
|
|
|||
|
|
@ -73,9 +73,9 @@ mkdir -p $DC_INSTALL_DIR/scripts
|
|||
cp -a scripts/terminal.sh $DC_INSTALL_DIR/scripts/
|
||||
|
||||
# Copy directories
|
||||
cp -r default $DC_INSTALL_DIR/
|
||||
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
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ cp -a doublecmd.zdli $DC_INSTALL_DIR/
|
|||
cp -a pinyin.tbl $DC_INSTALL_DIR/
|
||||
|
||||
# Copy default settings
|
||||
cp -r settings $DC_INSTALL_DIR/
|
||||
cp -r default $DC_INSTALL_DIR/
|
||||
|
||||
# copy plugins
|
||||
# WCX
|
||||
|
|
@ -146,6 +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
|
||||
mkdir $DC_INSTALL_DIR/settings
|
||||
touch $DC_INSTALL_DIR/settings/doublecmd.inf
|
||||
# Copy documentation
|
||||
mkdir -p $DC_INSTALL_DIR/doc
|
||||
|
|
|
|||
|
|
@ -58,10 +58,9 @@ 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\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\default\*"; DestDir: "{app}\default"; Flags: ignoreversion recursesubdirs createallsubdirs
|
||||
Source: "doublecmd\language\*"; DestDir: "{app}\language"; Flags: ignoreversion recursesubdirs createallsubdirs
|
||||
Source: "doublecmd\pixmaps\*"; DestDir: "{app}\pixmaps"; Flags: ignoreversion recursesubdirs createallsubdirs
|
||||
Source: "doublecmd\plugins\*"; DestDir: "{app}\plugins"; Flags: ignoreversion recursesubdirs createallsubdirs
|
||||
|
|
|
|||
|
|
@ -31,9 +31,9 @@ mkdir %DC_INSTALL_DIR%\plugins\wlx\wmp
|
|||
|
||||
mkdir %DC_INSTALL_DIR%\doc
|
||||
rem Copy directories
|
||||
xcopy /E default %DC_INSTALL_DIR%\default\
|
||||
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\
|
||||
|
|
|
|||
102
src/uglobs.pas
102
src/uglobs.pas
|
|
@ -731,7 +731,7 @@ uses
|
|||
uGlobsPaths, uLng, uShowMsg, uFileProcs, uOSUtils, uFindFiles, uEarlyConfig,
|
||||
dmHigh, uDCUtils, fMultiRename, uDCVersion, uDebug, uFileFunctions,
|
||||
uDefaultPlugins, Lua, uKeyboard, DCOSUtils, DCStrUtils, uPixMapManager,
|
||||
uSynDiffControls
|
||||
FileUtil, uSynDiffControls
|
||||
{$IF DEFINED(MSWINDOWS)}
|
||||
, ShlObj
|
||||
{$ENDIF}
|
||||
|
|
@ -1523,19 +1523,19 @@ end;
|
|||
|
||||
procedure CopySettingsFiles;
|
||||
begin
|
||||
{ Create default configuration files if need }
|
||||
if gpCfgDir <> gpGlobalCfgDir then
|
||||
begin
|
||||
// extension file
|
||||
if not mbFileExists(gpCfgDir + gcfExtensionAssociation) then
|
||||
CopyFile(gpGlobalCfgDir + gcfExtensionAssociation, gpCfgDir + gcfExtensionAssociation);
|
||||
// pixmaps file
|
||||
if not mbFileExists(gpCfgDir + 'pixmaps.txt') then
|
||||
CopyFile(gpGlobalCfgDir + 'pixmaps.txt', gpCfgDir + 'pixmaps.txt');
|
||||
// multiarc configuration file
|
||||
if not mbFileExists(gpCfgDir + sMULTIARC_FILENAME) then
|
||||
CopyFile(gpGlobalCfgDir + sMULTIARC_FILENAME, gpCfgDir + sMULTIARC_FILENAME);
|
||||
end;
|
||||
{
|
||||
Copy default configuration files if needed
|
||||
}
|
||||
// pixmaps file
|
||||
if not mbFileExists(gpCfgDir + 'pixmaps.txt') then
|
||||
begin
|
||||
CopyFile(gpExePath + 'default' + PathDelim + 'pixmaps.txt', gpCfgDir + 'pixmaps.txt');
|
||||
end;
|
||||
// multiarc configuration file
|
||||
if not mbFileExists(gpCfgDir + sMULTIARC_FILENAME) then
|
||||
begin
|
||||
CopyFile(gpExePath + 'default' + PathDelim + sMULTIARC_FILENAME, gpCfgDir + sMULTIARC_FILENAME);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure CreateGlobs;
|
||||
|
|
@ -2344,44 +2344,9 @@ begin
|
|||
CopySettingsFiles;
|
||||
|
||||
{ Internal associations }
|
||||
//"LoadExtsConfig" checks itself if file is present or not
|
||||
// "LoadExtsConfig" checks itself if file is present or not
|
||||
LoadConfigCheckErrors(@LoadExtsConfig, gpCfgDir + gcfExtensionAssociation, ErrorMessage);
|
||||
|
||||
if mbFileExists(gpCfgDir + 'dirhistory.txt') then
|
||||
begin
|
||||
LoadStringsFromFile(glsDirHistory, gpCfgDir + 'dirhistory.txt', cMaxStringItems);
|
||||
mbRenameFile(gpCfgDir + 'dirhistory.txt', gpCfgDir + 'dirhistory.txt.obsolete');
|
||||
end;
|
||||
if mbFileExists(gpCfgDir + 'cmdhistory.txt') then
|
||||
begin
|
||||
LoadStringsFromFile(glsCmdLineHistory, gpCfgDir + 'cmdhistory.txt', cMaxStringItems);
|
||||
mbRenameFile(gpCfgDir + 'cmdhistory.txt', gpCfgDir + 'cmdhistory.txt.obsolete');
|
||||
end;
|
||||
if mbFileExists(gpCfgDir + 'maskhistory.txt') then
|
||||
begin
|
||||
LoadStringsFromFile(glsMaskHistory, gpCfgDir + 'maskhistory.txt', cMaxStringItems);
|
||||
mbRenameFile(gpCfgDir + 'maskhistory.txt', gpCfgDir + 'maskhistory.txt.obsolete');
|
||||
end;
|
||||
if mbFileExists(gpCfgDir + 'searchpathhistory.txt') then
|
||||
begin
|
||||
LoadStringsFromFile(glsSearchPathHistory, gpCfgDir + 'searchpathhistory.txt', cMaxStringItems);
|
||||
mbRenameFile(gpCfgDir + 'searchpathhistory.txt', gpCfgDir + 'searchpathhistory.txt.obsolete');
|
||||
end;
|
||||
if mbFileExists(gpCfgDir + 'searchhistory.txt') then
|
||||
begin
|
||||
LoadStringsFromFile(glsSearchHistory, gpCfgDir + 'searchhistory.txt', cMaxStringItems);
|
||||
mbRenameFile(gpCfgDir + 'searchhistory.txt', gpCfgDir + 'searchhistory.txt.obsolete');
|
||||
end;
|
||||
if mbFileExists(gpCfgDir + 'replacehistory.txt') then
|
||||
begin
|
||||
LoadStringsFromFile(glsReplaceHistory, gpCfgDir + 'replacehistory.txt', cMaxStringItems);
|
||||
mbRenameFile(gpCfgDir + 'replacehistory.txt', gpCfgDir + 'replacehistory.txt.obsolete');
|
||||
end;
|
||||
if mbFileExists(gpCfgDir + 'replacehpathhistory.txt') then
|
||||
begin
|
||||
LoadStringsFromFile(glsReplacePathHistory, gpCfgDir + 'replacepathhistory.txt', cMaxStringItems);
|
||||
mbRenameFile(gpCfgDir + 'replacepathhistory.txt', gpCfgDir + 'replacepathhistory.txt.obsolete');
|
||||
end;
|
||||
LoadStringsFromFile(glsIgnoreList, ReplaceEnvVars(gIgnoreListFile));
|
||||
|
||||
{ Localization }
|
||||
|
|
@ -2400,10 +2365,6 @@ begin
|
|||
{ Hotkeys }
|
||||
if not mbFileExists(gpCfgDir + gNameSCFile) then
|
||||
gNameSCFile := 'shortcuts.scf';
|
||||
// Rename old shortcuts file to new name.
|
||||
if mbFileExists(gpCfgDir + 'shortcuts.ini') and
|
||||
not mbFileExists(gpCfgDir + gNameSCFile) then
|
||||
mbRenameFile(gpCfgDir + 'shortcuts.ini', gpCfgDir + gNameSCFile);
|
||||
LoadConfigCheckErrors(@LoadHotManConfig, gpCfgDir + gNameSCFile, ErrorMessage);
|
||||
|
||||
{ Colors }
|
||||
|
|
@ -2429,27 +2390,32 @@ end;
|
|||
|
||||
procedure SaveGlobs;
|
||||
var
|
||||
OldDir: String;
|
||||
ErrMsg: String = '';
|
||||
begin
|
||||
if (gUseConfigInProgramDirNew <> gUseConfigInProgramDir) and
|
||||
(gpCmdLineCfgDir = EmptyStr) then
|
||||
begin
|
||||
OldDir := gpCfgDir;
|
||||
|
||||
if gUseConfigInProgramDirNew then
|
||||
begin
|
||||
LoadPaths;
|
||||
|
||||
if gUseConfigInProgramDirNew then
|
||||
begin
|
||||
gpCfgDir := gpGlobalCfgDir;
|
||||
UpdateEnvironmentVariable;
|
||||
FileClose(mbFileCreate(gpGlobalCfgDir + 'doublecmd.inf'));
|
||||
end
|
||||
else begin
|
||||
if mbFileExists(gpGlobalCfgDir + 'doublecmd.inf') then
|
||||
mbDeleteFile(gpGlobalCfgDir + 'doublecmd.inf')
|
||||
end;
|
||||
|
||||
gConfig.FileName := gpCfgDir + 'doublecmd.xml';
|
||||
mbForceDirectory(gpGlobalCfgDir);
|
||||
FileClose(mbFileCreate(gpGlobalCfgDir + 'doublecmd.inf'));
|
||||
end
|
||||
else begin
|
||||
if mbFileExists(gpGlobalCfgDir + 'doublecmd.inf') then
|
||||
mbDeleteFile(gpGlobalCfgDir + 'doublecmd.inf')
|
||||
end;
|
||||
|
||||
LoadPaths;
|
||||
gConfig.FileName := gpCfgDir + 'doublecmd.xml';
|
||||
// Copy the configuration to a new location
|
||||
CopyDirTree(OldDir, gpCfgDir, [cffOverwriteFile]);
|
||||
|
||||
gUseConfigInProgramDir := gUseConfigInProgramDirNew;
|
||||
end;
|
||||
|
||||
if mbFileAccess(gpCfgDir, fmOpenWrite or fmShareDenyNone) then
|
||||
begin
|
||||
SaveWithCheck(@SaveEarlyConfig, 'early config', ErrMsg);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue