﻿// Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE

using System;
using System.Runtime.InteropServices;

namespace osu.Framework.Desktop.Platform
{
    internal static class Architecture
    {
        public static string NativeIncludePath => $@"{Environment.CurrentDirectory}/{arch}/";
        private static string arch => Is64Bit ? @"x64" : @"x86";

        internal static bool Is64Bit => IntPtr.Size == 8;

        [DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        static extern bool SetDllDirectory(string lpPathName);

        internal static void SetIncludePath()
        {
            //todo: make this not a thing for linux or whatever
            try
            {
                SetDllDirectory(NativeIncludePath);
            }
            catch { }
        }
    }
}

﻿// Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE

using System;
using System.Runtime.InteropServices;

namespace osu.Framework.Desktop.Platform
{
    internal static class Architecture
    {
        public static string NativeIncludePath => $@"{Environment.CurrentDirectory}/{arch}/";
        private static string arch => Is64Bit ? @"x64" : @"x86";

        internal static bool Is64Bit => IntPtr.Size == 8;

        [DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        static extern bool SetDllDirectory(string lpPathName);

        internal static void SetIncludePath()
        {
            if (RuntimeInfo.IsWindows)
                SetDllDirectory(NativeIncludePath);
        }
    }
}

Use RuntimeInfo.IsLinux to check for Linux
Use RuntimeInfo.IsLinux to check for Linux

It's quite easy to do this, FYI
