Skip to content

Commit

Permalink
use ripunzip for Windows to unzip faster (#12008)
Browse files Browse the repository at this point in the history
* use ripunzip for Windows to unzip faster

* fix the unzip command build

* add some more text on where ripuzip comes from
  • Loading branch information
adrpo committed Feb 22, 2024
1 parent 8c78c37 commit 6409138
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions OMCompiler/Compiler/Script/CevalScript.mo
Expand Up @@ -2964,14 +2964,19 @@ protected function unZipEncryptedPackageAndCheckFile
output Boolean success;
output String outFilename;
protected
String workdir, s1, s2, s3, filename_1, filename1, filename2, filename3, filename4, str, str1, str2, str3, str4;
String workdir, s1, s2, s3, filename_1, filename1, filename2, filename3, filename4, str, str1, str2, str3, str4, cmd, cmdPrefix;
Boolean isWindows = Autoconf.os == "Windows_NT";
algorithm
success := false;
outFilename := "";
if (System.regularFileExists(filename)) then
if (StringUtil.endsWith(filename, ".mol")) then
workdir := if System.directoryExists(inWorkdir) then inWorkdir else System.pwd();
if (skipUnzip or 0 == System.systemCall("unzip -q -o -d \"" + workdir + "\" \"" + filename + "\"")) then
// use ripunzip (https://github.com/google/ripunzip) on Windows as is twice as fast
// TODO on Linux we should check if it is in the path
cmdPrefix := if isWindows then "ripunzip.exe -q unzip-file -d " else "unzip -q -o -d ";
cmd := cmdPrefix + "\"" + workdir + "\" \"" + filename + "\"";
if (skipUnzip or 0 == System.systemCall(cmd)) then
s1 := System.basename(filename);
s2 := Util.removeLast4Char(s1);
s3 := listGet(Util.stringSplitAtChar(s2," "),1);
Expand Down

0 comments on commit 6409138

Please sign in to comment.