forked from IronLanguages/ironpython3
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_ctypes_test.cs
More file actions
35 lines (27 loc) · 1.32 KB
/
_ctypes_test.cs
File metadata and controls
35 lines (27 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
#if FEATURE_CTYPES
using System;
using System.IO;
using IronPython.Runtime;
[assembly: PythonModule("_ctypes_test", typeof(IronPython.Modules.CTypesTest))]
namespace IronPython.Modules {
public static class CTypesTest {
private static string FindRoot() {
// we start at the current directory and look up until we find the "Src" directory
var current = System.Reflection.Assembly.GetExecutingAssembly().Location;
var found = false;
while (!found && !string.IsNullOrEmpty(current)) {
var test = Path.Combine(current, "Src", "StdLib", "Lib");
if (Directory.Exists(test)) {
return current;
}
current = Path.GetDirectoryName(current);
}
return string.Empty;
}
public static string __file__ = Path.Combine(FindRoot(), "Tests", string.Format("_ctypes_test_{0}{1}.pyd", Environment.OSVersion.Platform == PlatformID.Win32NT ? "win" : Environment.OSVersion.Platform == PlatformID.MacOSX ? "macOS" : "linux", Environment.Is64BitProcess ? 64 : 32));
}
}
#endif