ADD: Capability to use configuration from plugin path

This commit is contained in:
Alexander Koblov 2015-08-30 17:45:49 +00:00
commit 2ecf5b4d15
2 changed files with 12 additions and 2 deletions

View file

@ -409,13 +409,20 @@ var
ModulePath: AnsiString;
begin
// Save configuration file name
ConfigFile:= ExtractFilePath(dps^.DefaultIniName) + 'sevenzip.ini';
ConfigFile:= ExtractFilePath(dps^.DefaultIniName) + DefaultIniName;
// Get plugin path
if GetModulePath(ModulePath) then
begin
// Use configuration from plugin path
if FileExistsUTF8(ModulePath + DefaultIniName) then
ConfigFile:= ModulePath + DefaultIniName;
end;
// Load plugin configuration
LoadConfiguration;
// Try to find library path
if FileExistsUTF8(LibraryPath) then
SevenzipLibraryName:= LibraryPath
else if GetModulePath(ModulePath) then
else if Length(ModulePath) > 0 then
begin
if FileExistsUTF8(ModulePath + TargetCPU + PathDelim + SevenzipDefaultLibraryName) then
SevenzipLibraryName:= ModulePath + TargetCPU + PathDelim + SevenzipDefaultLibraryName

View file

@ -168,6 +168,9 @@ procedure SetArchiveOptions(AJclArchive: IInterface);
procedure LoadConfiguration;
procedure SaveConfiguration;
const
DefaultIniName = 'sevenzip.ini';
var
ConfigFile: AnsiString;
LibraryPath: AnsiString;