Martijn Laan 1 bulan lalu
induk
melakukan
786de6063e
3 mengubah file dengan 11 tambahan dan 4 penghapusan
  1. 4 0
      ISHelp/isetup.xml
  2. 6 3
      Projects/ISSigTool.dpr
  3. 1 1
      issig.bat

+ 4 - 0
ISHelp/isetup.xml

@@ -3836,6 +3836,10 @@ issigtool verify "MyFile.txt"
 <td>Specifies the private key filename required for signing. This option overrides the <tt>ISSIGTOOL_KEY_FILE</tt> environment variable which can also be used.</td>
 </tr>
 <tr>
+<td>--allow-overwrite, -o</td>
+<td>Allow to overwrite existing files.</td>
+</tr>
+<tr>
 <td>--quiet, -q</td>
 <td>Suppresses status messages that are normally printed to standard output.</td>
 </tr>

+ 6 - 3
Projects/ISSigTool.dpr

@@ -34,7 +34,7 @@ uses
 var
   Options: record
     KeyFile: String;
-    Quiet: Boolean;
+    AllowOverwrite, Quiet: Boolean;
   end;
 
   StdOutHandle, StdErrHandle: THandle;
@@ -135,7 +135,7 @@ begin
         PrintFmtUnlessQuiet('%s: ', [AFilename], False);
         PrintUnlessQuiet('public key unchanged');
         Exit;
-      end else
+      end else if not Options.AllowOverwrite then
         RaiseFatalError('File already exists');
     end;
 
@@ -149,7 +149,7 @@ end;
 
 procedure CommandGeneratePrivateKey;
 begin
-  if NewFileExists(Options.KeyFile) then
+  if not Options.AllowOverwrite and NewFileExists(Options.KeyFile) then
     RaiseFatalError('File already exists');
 
   PrintFmtUnlessQuiet('%s: ', [Options.KeyFile], False);
@@ -303,6 +303,7 @@ begin
   PrintErrOutput('or to generate a new private key:  issigtool [options] generate-private-key');
   PrintErrOutput('Options:');
   PrintErrOutput('  --key-file=<filename> Specifies the private key filename (overrides ISSIGTOOL_KEY_FILE environment variable)');
+  PrintErrOutput('  --allow-overwrite, -o Allow to overwrite existing files');
   PrintErrOutput('  --quiet, -q           Suppresses status messages that are normally printed to standard output');
   PrintErrOutput('  --help, -?            Prints this information');
   PrintErrOutput('');
@@ -325,6 +326,8 @@ begin
           if InitialArgListCount <> 1 then
             RaiseFatalErrorFmt('"%s" option cannot be combined with other arguments', [S]);
           Exit;
+        end else if (S = '--allow-overwrite') or (S = '-o') then begin
+          Options.AllowOverwrite := True;
         end else if (S = '--quiet') or (S = '-q') then begin
           Options.Quiet := True;
         end else if S.StartsWith('--key-file=') then begin

+ 1 - 1
issig.bat

@@ -49,7 +49,7 @@ if not "%1"=="" goto failed
 
 :embed
 set publickeyfile=def02.ispublickey
-Files\ISSigTool.exe export-public-key "%publickeyfile%"
+Files\ISSigTool.exe --allow-overwrite export-public-key "%publickeyfile%"
 if errorlevel 1 goto failed
 if not exist "%publickeyfile%" goto failed
 set targetfile=Components\TrustFunc.AllowedPublicKeys.inc