[View]  [Edit]  [Lock]  [References]  [Attachments]  [History]  [Home]  [Changes]  [Search]  [Help] 

test[nodeJS] 049 File linking (async)

"049-13 File linking with #link:dstpath:with:"
(NodeJS process platform = #win32) ifTrue:[

'Content generated by S8.'
    outputToFile: (TestPath,'Sample49-13.txt').
NodeJS fs
    link: (TestPath,'Sample49-13.txt')
    dstpath: (TestPath, 'Sample49-13.link.txt')
    with: [:error|
       error isNil ifFalse:[^self error: '049-13 ', error ].
    ].

] ifFalse:[ self print:'#link:dstpath:with: only works in Windows OS'].


"049-14 File linking with #symlink:path:type:with:"
(NodeJS process platform = #win32) ifTrue:[
   'Content generated by S8.' outputToFile: (TestPath,'Sample49-14.txt').
   NodeJS fs symlink: (TestPath,'Sample49-14.txt') path: (TestPath, 'Sample49-14.link.txt') with:[:error| 
      error isNil ifFalse:[ (error#code = #EPERM) ifTrue:[
         self print:'049-14 Required permission for create symbolic link in Windows are not present'] ifFalse:[ 
         ^self error: '049-14 ',error]. 
      ].
   ].
] ifFalse:[ self print:'#symlink:path:type:with: only works in Windows OS'].