File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -117,6 +117,27 @@ def test_dir
117117 ret
118118 end
119119 end
120+
121+ if ( session . platform == 'windows' )
122+ it 'should delete a junction target' do
123+ mkdir ( datastore [ 'BaseDirectoryName' ] )
124+ ret = directory? ( datastore [ 'BaseDirectoryName' ] )
125+ link = "#{ datastore [ 'BaseDirectoryName' ] } .junc"
126+ ret &&= write_file ( [ datastore [ 'BaseDirectoryName' ] , 'file' ] . join ( fs_sep ) , '' )
127+ make_junction ( datastore [ 'BaseDirectoryName' ] , link )
128+ unless exists? ( link )
129+ print_error ( 'failed to create the symbolic link' )
130+ end
131+ rm_rf ( link )
132+ # the link should have been deleted
133+ ret &&= !exists? ( link )
134+ # but the target directory and its contents should still be intact
135+ ret &&= exists? ( "#{ [ datastore [ 'BaseDirectoryName' ] , 'file' ] . join ( fs_sep ) } " )
136+ rm_rf ( datastore [ 'BaseDirectoryName' ] )
137+ ret
138+ end
139+ end
140+
120141 end
121142
122143 def test_file
@@ -289,6 +310,10 @@ def test_path_expansion_nix
289310 end
290311 end
291312
313+ def make_junction ( target , symlink )
314+ cmd_exec ( "cmd.exe" , "/c mklink #{ directory? ( target ) ? '/J ' : '' } #{ symlink } #{ target } " )
315+ end
316+
292317 def make_symlink ( target , symlink )
293318 if session . platform == 'windows'
294319 cmd_exec ( "cmd.exe" , "/c mklink #{ directory? ( target ) ? '/D ' : '' } #{ symlink } #{ target } " )
You can’t perform that action at this time.
0 commit comments