mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-28 10:02:14 +00:00
ADD: Update plugins if DC version is changed
This commit is contained in:
parent
cf4a956a5f
commit
cd8fa9a35f
2 changed files with 125 additions and 1 deletions
112
src/platform/udefaultplugins.pas
Normal file
112
src/platform/udefaultplugins.pas
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
unit uDefaultPlugins;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils;
|
||||
|
||||
procedure UpdatePlugins;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
uGlobs;
|
||||
|
||||
procedure UpdatePlugins;
|
||||
var
|
||||
I: Integer;
|
||||
Folder: UTF8String;
|
||||
begin
|
||||
// Wcx plugins
|
||||
Folder:= '%commander_path%' + PathDelim + 'plugins' + PathDelim + 'wcx' + PathDelim;
|
||||
|
||||
I:= gWCXPlugins.IndexOfName('zip');
|
||||
if I < 0 then
|
||||
gWCXPlugins.Add('zip', 607, Folder + 'zip' + PathDelim + 'zip.wcx')
|
||||
else
|
||||
gWCXPlugins.Flags[I]:= 607;
|
||||
|
||||
I:= gWCXPlugins.IndexOfName('lzma');
|
||||
if I < 0 then
|
||||
gWCXPlugins.Add('lzma', 65, Folder + 'lzma' + PathDelim + 'lzma.wcx')
|
||||
else
|
||||
gWCXPlugins.Flags[I]:= 65;
|
||||
|
||||
I:= gWCXPlugins.IndexOfName('tar');
|
||||
if I < 0 then
|
||||
gWCXPlugins.Add('tar', 95, Folder + 'zip' + PathDelim + 'zip.wcx')
|
||||
else
|
||||
gWCXPlugins.Flags[I]:= 95;
|
||||
|
||||
I:= gWCXPlugins.IndexOfName('bz2');
|
||||
if I < 0 then
|
||||
gWCXPlugins.Add('bz2', 91, Folder + 'zip' + PathDelim + 'zip.wcx')
|
||||
else
|
||||
begin
|
||||
gWCXPlugins.Flags[I]:= 91;
|
||||
// For bz2 used another plugin, so update path too
|
||||
gWCXPlugins.FileName[I]:= Folder + 'zip' + PathDelim + 'zip.wcx';
|
||||
end;
|
||||
|
||||
I:= gWCXPlugins.IndexOfName('tbz');
|
||||
if I < 0 then
|
||||
gWCXPlugins.Add('tbz', 95, Folder + 'zip' + PathDelim + 'zip.wcx')
|
||||
else
|
||||
gWCXPlugins.Flags[I]:= 95;
|
||||
|
||||
I:= gWCXPlugins.IndexOfName('gz');
|
||||
if I < 0 then
|
||||
gWCXPlugins.Add('gz', 91, Folder + 'zip' + PathDelim + 'zip.wcx')
|
||||
else
|
||||
gWCXPlugins.Flags[I]:= 91;
|
||||
|
||||
I:= gWCXPlugins.IndexOfName('tgz');
|
||||
if I < 0 then
|
||||
gWCXPlugins.Add('tgz', 95, Folder + 'zip' + PathDelim + 'zip.wcx')
|
||||
else
|
||||
gWCXPlugins.Flags[I]:= 95;
|
||||
|
||||
I:= gWCXPlugins.IndexOfName('cpio');
|
||||
if I < 0 then
|
||||
gWCXPlugins.Add('cpio', 0, Folder + 'cpio' + PathDelim + 'cpio.wcx')
|
||||
else
|
||||
gWCXPlugins.Flags[I]:= 0;
|
||||
|
||||
I:= gWCXPlugins.IndexOfName('deb');
|
||||
if I < 0 then
|
||||
gWCXPlugins.Add('deb', 4, Folder + 'deb' + PathDelim + 'deb.wcx')
|
||||
else
|
||||
gWCXPlugins.Flags[I]:= 4;
|
||||
|
||||
I:= gWCXPlugins.IndexOfName('rpm');
|
||||
if I < 0 then
|
||||
gWCXPlugins.Add('rpm', 4, Folder + 'rpm' + PathDelim + 'rpm.wcx')
|
||||
else
|
||||
gWCXPlugins.Flags[I]:= 4;
|
||||
|
||||
I:= gWCXPlugins.IndexOfName('rar');
|
||||
if I < 0 then
|
||||
gWCXPlugins.Add('rar', 4, Folder + 'unrar' + PathDelim + 'unrar.wcx')
|
||||
else
|
||||
gWCXPlugins.Flags[I]:= 4;
|
||||
|
||||
// Wfx plugins
|
||||
Folder:= '%commander_path%' + PathDelim + 'plugins' + PathDelim + 'wfx' + PathDelim;
|
||||
|
||||
if gWFXPlugins.IndexOfName('FTP') < 0 then
|
||||
begin
|
||||
gWFXPlugins.Add('FTP', Folder + 'ftp' + PathDelim + 'ftp.wfx');
|
||||
end;
|
||||
|
||||
{$IF DEFINED(UNIX)}
|
||||
if gWFXPlugins.IndexOfName('Windows Network') < 0 then
|
||||
begin
|
||||
gWFXPlugins.Add('Windows Network', Folder + 'samba' + PathDelim + 'samba.wfx');
|
||||
end;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
|
@ -319,7 +319,13 @@ implementation
|
|||
|
||||
uses
|
||||
LCLProc, SysUtils, uGlobsPaths, uLng, uShowMsg, uFileProcs, uOSUtils,
|
||||
uDCUtils, fMultiRename, uFile, uDCVersion, uDebug, uFileFunctions;
|
||||
uDCUtils, fMultiRename, uFile, uDCVersion, uDebug, uFileFunctions,
|
||||
uDefaultPlugins;
|
||||
|
||||
var
|
||||
// Double Commander version
|
||||
// loaded from configuration file
|
||||
gPreviousVersion: UTF8String = '';
|
||||
|
||||
procedure LoadDefaultHotkeyBindings;
|
||||
var
|
||||
|
|
@ -951,6 +957,9 @@ begin
|
|||
Exit(False);
|
||||
end;
|
||||
|
||||
// Update plugins if DC version is changed
|
||||
if (gPreviousVersion <> dcVersion) then UpdatePlugins;
|
||||
|
||||
// Set secondary variables for options that need restart.
|
||||
gShowIconsNew := gShowIcons;
|
||||
gIconsSizeNew := gIconsSize;
|
||||
|
|
@ -1397,6 +1406,9 @@ begin
|
|||
begin
|
||||
Root := gConfig.RootNode;
|
||||
|
||||
{ Double Commander Version }
|
||||
gPreviousVersion:= GetAttr(Root, 'DCVersion', EmptyStr);
|
||||
|
||||
{ Language page }
|
||||
gPOFileName := GetValue(Root, 'Language/POFileName', gPOFileName);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue