Skip to content

Commit

Permalink
Force codepage to 437, even in internernational (non-US) Windows inst…
Browse files Browse the repository at this point in the history
…allations

Signed-off-by: Stuart Preston <stuart@chef.io>
  • Loading branch information
Stuart Preston committed Jan 26, 2018
1 parent 5735b03 commit dcbe41f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
19 changes: 12 additions & 7 deletions CustomActionFastMsi/CustomAction.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using ICSharpCode.SharpZipLib.Zip;
using Microsoft.Deployment.WindowsInstaller;
using ICSharpCode.SharpZipLib.Zip;
using ICSharpCode.SharpZipLib.Core;
using System.Diagnostics;
using System.IO;

namespace CustomActionFastMsi
{
Expand Down Expand Up @@ -36,11 +33,19 @@ public static ActionResult FastUnzip(Session session)

var fastzip = new FastZip();

// Force zip library to use codepage 437 (IBM PC US) rather than autodetecting the system codepage.
// ref: http://community.sharpdevelop.net/forums/t/19065.aspx
// ref: https://stackoverflow.com/questions/46950386/sharpziplib-1-is-not-a-supported-code-page
ZipConstants.DefaultCodePage = 437;

session.Log("Starting extraction");

var stopWatch = new Stopwatch();
stopWatch.Start();
fastzip.ExtractZip(zipFile, Path.Combine(targetDir, appName), null);
stopWatch.Stop();

session.Log("Finished extraction");
session.Log(string.Format("Finished extraction (time taken: {0} ms)", stopWatch.ElapsedMilliseconds));

File.Delete(zipFile);

Expand Down
3 changes: 0 additions & 3 deletions CustomActionFastMsi/CustomActionFastMsi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@
<HintPath>ext\ICSharpCode.SharpZipLib.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.Deployment.WindowsInstaller">
<Private>True</Private>
Expand Down

0 comments on commit dcbe41f

Please sign in to comment.