Skip to content

Commit ec2cc63

Browse files
committed
Исправлена загрузка 32-битных внешних компонент NativeApi из ZIP-архива в 64-битной среде
1 parent ea3a6e8 commit ec2cc63

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/OneScript.StandardLibrary/NativeApi/NativeApiPackage.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ public static bool IsZip(Stream stream)
2626
const int ZIP_LEAD_BYTES = 0x04034b50;
2727
return (BitConverter.ToInt32(bytes, 0) == ZIP_LEAD_BYTES);
2828
}
29+
30+
private static bool Is64BitProcess()
31+
{
32+
return IntPtr.Size == 8;
33+
}
2934

3035
public static void Extract(Stream stream, String tempfile)
3136
{
@@ -50,7 +55,7 @@ private static String GetEntryName(ZipFile zip)
5055
using (var reader = XmlReader.Create(stream))
5156
{
5257
var thisOs = NativeApiProxy.IsLinux ? "Linux" : "Windows";
53-
var thisArch = System.Environment.Is64BitOperatingSystem ? "x86_64" : "i386";
58+
var thisArch = Is64BitProcess() ? "x86_64" : "i386";
5459
while (reader.ReadToFollowing("component"))
5560
{
5661
var attrOs = reader.GetAttribute("os");

0 commit comments

Comments
 (0)