diff --git a/examples/electron/src/finclip.js b/examples/electron/src/finclip.js index d0842d9..c314e98 100644 --- a/examples/electron/src/finclip.js +++ b/examples/electron/src/finclip.js @@ -1,4 +1,5 @@ const koffi = require('koffi'); +const os = require('os'); const finclip = {}; let lib; @@ -14,7 +15,9 @@ const loadLibrary = libraryPath => { finclip.finclip_params_set = lib.func('finclip_params_set', 'int', ['POINT', 'string', 'string']); finclip.finclip_init_with_config = lib.func('finclip_init_with_config', 'int', ['string', 'POINT']); finclip.finclip_start_applet = lib.func('finclip_start_applet', 'int', ['string', 'string']); - finclip.finclip_start_applet_embed = lib.func('finclip_start_applet_embed', 'int', ['string', 'string', 'POINT', 'int']); + if (os.platform() === 'win32') { + finclip.finclip_start_applet_embed = lib.func('finclip_start_applet_embed', 'int', ['string', 'string', 'POINT', 'int']); + } finclip.finclip_close_applet = lib.func('finclip_close_applet', 'int', ['string']); finclip.finclip_set_position = lib.func('finclip_set_position', 'int', ['string', 'int', 'int', 'int', 'int']); finclip.finclip_callback_success = lib.func('finclip_callback_success', 'int', ['int', 'POINT']); diff --git a/examples/electron/src/main.js b/examples/electron/src/main.js index ead4a27..0925278 100644 --- a/examples/electron/src/main.js +++ b/examples/electron/src/main.js @@ -12,8 +12,16 @@ let embed = { x: 300, y: 0 }; let isOpen = false; let isEmbed = false; -const finclipPath = path.resolve(__dirname, '../../../vendor/win/x64/FinClip/FinClip.exe'); -const libraryPath = path.resolve(__dirname, '../../../vendor/win/x64', 'FinClipSDKWrapper.dll'); +let finclipPath; +let libraryPath; + +if (os.platform() === 'win32') { + finclipPath = path.resolve(__dirname, '../../../vendor/win/x64/FinClip/FinClip.exe'); + libraryPath = path.resolve(__dirname, '../../../vendor/win/x64', 'FinClipSDKWrapper.dll'); +} else if (os.platform() === 'darwin') { + finclipPath = path.resolve(__dirname, '../../../vendor/mac/x64/FinClip.app'); + libraryPath = path.resolve(__dirname, '../../../vendor/mac/x64', 'libFinClipSDKWrapper.so'); +} finclip.load_library(libraryPath); @@ -62,6 +70,7 @@ const openFinClipWindow = (arg) => { const embedFinClipWindow = () => { if (!isOpen) return; + if (os.platform() !== 'win32') return; createChildWindow(); finclip.finclip_start_applet_embed("1", appid_, config_, hwnd); resizeChildWindow(); diff --git a/vendor/mac/.gitignore b/vendor/mac/.gitignore new file mode 100644 index 0000000..051c921 --- /dev/null +++ b/vendor/mac/.gitignore @@ -0,0 +1,2 @@ +arm/ +x64/ \ No newline at end of file