mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2026-03-13 09:24:25 +08:00
Allow custom portable settings filename as a command line switch. Fixes issue #2469.
This commit is contained in:
@@ -51,6 +51,7 @@ and are based on those used by the MySQL command line applications, e.g. mysqldu
|
||||
-p, -password Password
|
||||
-P, -port Port (defaults to 3306 if not given)
|
||||
-S, -socket Socket name (for connecting via named pipe)
|
||||
--psettings Custom filename for portable settings. Ignored if file does not exist.
|
||||
|
||||
Examples:
|
||||
|
||||
@@ -68,6 +69,9 @@ Examples:
|
||||
* Open multiple .sql files in query tabs:
|
||||
c:\path\to\heidisql.exe fileA.sql path\to\fileB.sql fileC.sql ...
|
||||
|
||||
* Use custom portable settings file:
|
||||
c:\path\to\heidisql.exe --psettings=c:\temp\p.txt
|
||||
|
||||
|
||||
*** License:
|
||||
|
||||
|
||||
@@ -2320,7 +2320,18 @@ const
|
||||
end;
|
||||
begin
|
||||
// Export registry keys and values into textfile, for portable reasons
|
||||
FileName := ExtractFilePath(ParamStr(0)) + 'portable_settings.txt';
|
||||
|
||||
// Use filename from command line. If not given, use file in directory of executable.
|
||||
rx := TRegExpr.Create;
|
||||
rx.Expression := '^\-\-?psettings\=(.+)$';
|
||||
for i:=1 to ParamCount do begin
|
||||
if rx.Exec(ParamStr(i)) then begin
|
||||
Filename := rx.Match[1];
|
||||
break;
|
||||
end;
|
||||
end;
|
||||
if Filename = '' then
|
||||
Filename := ExtractFilePath(ParamStr(0)) + 'portable_settings.txt';
|
||||
if not FileExists(FileName) then
|
||||
Exit;
|
||||
|
||||
@@ -2380,7 +2391,6 @@ begin
|
||||
MainReg.OpenKeyReadOnly('\Software\');
|
||||
AllKeys := TStringList.Create;
|
||||
MainReg.GetKeyNames(AllKeys);
|
||||
rx := TRegExpr.Create;
|
||||
rx.Expression := '^' + QuoteRegExprMetaChars(APPNAME) + ' Portable (\d+)$';
|
||||
for i:=0 to AllKeys.Count-1 do begin
|
||||
if not rx.Exec(AllKeys[i]) then
|
||||
|
||||
Reference in New Issue
Block a user