File tree 1 file changed +25
-0
lines changed
1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -117,6 +117,27 @@ def test_dir
117
117
ret
118
118
end
119
119
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
+
120
141
end
121
142
122
143
def test_file
@@ -289,6 +310,10 @@ def test_path_expansion_nix
289
310
end
290
311
end
291
312
313
+ def make_junction ( target , symlink )
314
+ cmd_exec ( "cmd.exe" , "/c mklink #{ directory? ( target ) ? '/J ' : '' } #{ symlink } #{ target } " )
315
+ end
316
+
292
317
def make_symlink ( target , symlink )
293
318
if session . platform == 'windows'
294
319
cmd_exec ( "cmd.exe" , "/c mklink #{ directory? ( target ) ? '/D ' : '' } #{ symlink } #{ target } " )
You can’t perform that action at this time.
0 commit comments