var path = require('path')

var os_name = '';
var cpu_arch = '';
if (process.platform === 'win32') {
    os_name = 'windows';
} else {
    os_name = process.platform;
}
if (process.arch === 'ia32') {
    cpu_arch = 'x86';
} else if (process.arch === 'x64') {
    cpu_arch = 'x64';
} else {
    cpu_arch = process.arch;
}

var addon_path = `./${os_name}/${cpu_arch}/finclip_sdkcore_wrapper_addon`
var addonPath = path.join(__dirname, addon_path)

var addon
try {
    addon = require(addonPath)
} catch (error) {
    console.error('不支持的 cpu 平台', error);
    addon = {}
}

module.exports = addon