@@ -65,7 +65,7 @@ describe('library', () => {
6565 'Version=1.0' ,
6666 'Type=Application' ,
6767 'Terminal=false' ,
68- 'Exec=/home/DUMMY/file.ext' ,
68+ 'Exec=" /home/DUMMY/file.ext" ' ,
6969 'Name=file'
7070 ] . join ( '\n' ) ) ;
7171 } ) ;
@@ -80,7 +80,7 @@ describe('library', () => {
8080 'Version=1.0' ,
8181 'Type=Application' ,
8282 'Terminal=true' ,
83- 'Exec=/home/DUMMY/file.ext' ,
83+ 'Exec=" /home/DUMMY/file.ext" ' ,
8484 'Name=file'
8585 ] . join ( '\n' ) ) ;
8686 } ) ;
@@ -96,7 +96,7 @@ describe('library', () => {
9696 'Version=1.0' ,
9797 'Type=Directory' ,
9898 'Terminal=false' ,
99- 'Exec=/home/DUMMY' ,
99+ 'Exec=" /home/DUMMY" ' ,
100100 'Name=DUMMY'
101101 ] . join ( '\n' ) ) ;
102102 } ) ;
@@ -111,7 +111,7 @@ describe('library', () => {
111111 'Version=1.0' ,
112112 'Type=Application' ,
113113 'Terminal=false' ,
114- 'Exec=/home/DUMMY/file.ext' ,
114+ 'Exec=" /home/DUMMY/file.ext" ' ,
115115 'Name=Test'
116116 ] . join ( '\n' ) ) ;
117117 } ) ;
@@ -126,7 +126,7 @@ describe('library', () => {
126126 'Version=1.0' ,
127127 'Type=Application' ,
128128 'Terminal=false' ,
129- 'Exec=/home/DUMMY/file.ext' ,
129+ 'Exec=" /home/DUMMY/file.ext" ' ,
130130 'Name=file' ,
131131 'comment=Test'
132132 ] . join ( '\n' ) ) ;
@@ -142,7 +142,7 @@ describe('library', () => {
142142 'Version=1.0' ,
143143 'Type=Application' ,
144144 'Terminal=false' ,
145- 'Exec=/home/DUMMY/file.ext' ,
145+ 'Exec=" /home/DUMMY/file.ext" ' ,
146146 'Name=file' ,
147147 'Icon=/home/DUMMY/icon.png'
148148 ] . join ( '\n' ) ) ;
@@ -158,7 +158,23 @@ describe('library', () => {
158158 'Version=1.0' ,
159159 'Type=Application' ,
160160 'Terminal=false' ,
161- 'Exec=/home/DUMMY/file.ext -f --version' ,
161+ 'Exec="/home/DUMMY/file.ext" -f --version' ,
162+ 'Name=file'
163+ ] . join ( '\n' ) ) ;
164+ } ) ;
165+
166+ test ( 'Arguments with file path space' , ( ) => {
167+ options . linux . filePath = '/home/DUMMY/foo bar/file.ext' ;
168+ options . linux . arguments = '-f --version' ;
169+
170+ expect ( library . generateLinuxFileData ( options ) )
171+ . toEqual ( [
172+ '#!/user/bin/env xdg-open' ,
173+ '[Desktop Entry]' ,
174+ 'Version=1.0' ,
175+ 'Type=Application' ,
176+ 'Terminal=false' ,
177+ 'Exec="/home/DUMMY/foo bar/file.ext" -f --version' ,
162178 'Name=file'
163179 ] . join ( '\n' ) ) ;
164180 } ) ;
@@ -199,7 +215,7 @@ describe('library', () => {
199215 'Version=1.0' ,
200216 'Type=Application' ,
201217 'Terminal=false' ,
202- 'Exec=/home/DUMMY/file.ext' ,
218+ 'Exec=" /home/DUMMY/file.ext" ' ,
203219 'Name=file'
204220 ] . join ( '\n' )
205221 ) ;
@@ -222,7 +238,7 @@ describe('library', () => {
222238 'Version=1.0' ,
223239 'Type=Application' ,
224240 'Terminal=false' ,
225- 'Exec=/home/DUMMY/file.ext' ,
241+ 'Exec=" /home/DUMMY/file.ext" ' ,
226242 'Name=file'
227243 ] . join ( '\n' ) ,
228244 'Successfully errored'
@@ -246,7 +262,7 @@ describe('library', () => {
246262 'Version=1.0' ,
247263 'Type=Application' ,
248264 'Terminal=false' ,
249- 'Exec=/home/DUMMY/file.ext' ,
265+ 'Exec=" /home/DUMMY/file.ext" ' ,
250266 'Name=file'
251267 ] . join ( '\n' )
252268 ) ;
@@ -279,7 +295,7 @@ describe('library', () => {
279295 'Version=1.0' ,
280296 'Type=Application' ,
281297 'Terminal=false' ,
282- 'Exec=/home/DUMMY/file.ext' ,
298+ 'Exec=" /home/DUMMY/file.ext" ' ,
283299 'Name=file'
284300 ] . join ( '\n' )
285301 ) ;
@@ -411,6 +427,35 @@ describe('library', () => {
411427 ) ;
412428 } ) ;
413429
430+ test ( 'Windows arguments' , ( ) => {
431+ options . windows . arguments = '--force' ;
432+
433+ expect ( library . makeWindowsShortcut ( options ) )
434+ . toEqual ( true ) ;
435+
436+ expect ( customLogger )
437+ . not . toHaveBeenCalled ( ) ;
438+
439+ expect ( childProcess . execSync )
440+ . not . toHaveBeenCalled ( ) ;
441+
442+ expect ( childProcess . spawnSync )
443+ . toHaveBeenLastCalledWith (
444+ 'wscript' ,
445+ [
446+ library . produceWindowsVBSPath ( ) ,
447+ 'C:/Users/DUMMY/Desktop/file.lnk' ,
448+ 'C:/file.ext' ,
449+ '--force' ,
450+ '' ,
451+ '' ,
452+ 'C:/file.ext' ,
453+ 1 ,
454+ ''
455+ ]
456+ ) ;
457+ } ) ;
458+
414459 test ( 'Windows.vbs not found' , ( ) => {
415460 const fsExistsSync = fs . existsSync ;
416461 fs . existsSync = jest . fn ( ( ) => {
@@ -669,7 +714,7 @@ describe('library', () => {
669714 'Version=1.0' ,
670715 'Type=Application' ,
671716 'Terminal=false' ,
672- 'Exec=/home/DUMMY/file.ext' ,
717+ 'Exec=" /home/DUMMY/file.ext" ' ,
673718 'Name=file'
674719 ] . join ( '\n' )
675720 ) ;
@@ -767,7 +812,7 @@ describe('library', () => {
767812 'Version=1.0' ,
768813 'Type=Application' ,
769814 'Terminal=false' ,
770- 'Exec=/home/DUMMY/file.ext' ,
815+ 'Exec=" /home/DUMMY/file.ext" ' ,
771816 'Name=file'
772817 ] . join ( '\n' )
773818 ) ;
@@ -844,7 +889,7 @@ describe('library', () => {
844889 'Version=1.0' ,
845890 'Type=Application' ,
846891 'Terminal=false' ,
847- 'Exec=/home/DUMMY/file.ext' ,
892+ 'Exec=" /home/DUMMY/file.ext" ' ,
848893 'Name=file'
849894 ] . join ( '\n' )
850895 ) ;
0 commit comments