Skip to content

Commit 821b84b

Browse files
committed
Create the parent directory if the target does not exist
The `target_directory` option does not make sense unless the target is not a directory.
1 parent 259845b commit 821b84b

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎tool/lib/path.rb‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,13 @@ def ln_dir_relative(src, dest, target_directory: true)
8686
end
8787

8888
private def ln_target_directory(dest, target_directory)
89-
if target_directory
90-
dest
89+
if target_directory and File.directory?(dest)
90+
parent = dest
9191
else
9292
parent = File.dirname(dest)
93-
File.directory?(parent) or mkdir_p(parent)
94-
parent
9593
end
94+
File.directory?(parent) or mkdir_p(parent)
95+
parent
9696
end
9797

9898
case (CROSS_COMPILING || RUBY_PLATFORM)

0 commit comments

Comments
 (0)