@@ -5,7 +5,10 @@ const fs = require('fs');
55const axios = require ( 'axios' ) ;
66const os = require ( 'os' ) ;
77
8- const binaryPath = path . join ( __dirname , 'bin' , 'simplelocalize' ) ;
8+ let binaryPath = path . join ( __dirname , 'bin' , 'simplelocalize' ) ;
9+ if ( os . platform ( ) === 'win32' ) {
10+ binaryPath += '.exe' ;
11+ }
912
1013const isBinaryInstalled = ( ) => {
1114 try {
@@ -69,18 +72,20 @@ async function installBinary() {
6972 writer . on ( 'error' , reject ) ;
7073 } ) ;
7174
72- console . log ( 'SimpleLocalize CLI downloaded successfully!' ) ;
73-
7475 // Make it executable (only on Unix-based systems)
7576 if ( os . platform ( ) !== 'win32' ) {
77+ console . log ( 'Making binary executable...' ) ;
7678 fs . chmodSync ( binaryPath , 0o755 ) ;
7779 }
78-
79- console . log ( 'Binary is now executable.' ) ;
8080}
8181
8282const linkToNodeModulesBin = ( ) => {
83- const nodeModulesBinPath = path . join ( __dirname , '..' , '..' , '.bin' , 'simplelocalize' ) ;
83+ let nodeModulesBinPath = path . join ( __dirname , '..' , '..' , '.bin' , 'simplelocalize' ) ;
84+
85+ if ( os . platform ( ) === 'win32' ) {
86+ nodeModulesBinPath += '.exe' ;
87+ }
88+
8489 if ( fs . existsSync ( nodeModulesBinPath ) ) {
8590 fs . unlinkSync ( nodeModulesBinPath ) ;
8691 }
0 commit comments