Create parent directory for artifacts with sudo if necessary.

This commit is contained in:
Markus Reiter 2019-02-06 21:18:06 +01:00
parent 3349da1c1b
commit 2090f057a0

View File

@ -40,7 +40,11 @@ module Cask
end
ohai "Moving #{self.class.english_name} '#{source.basename}' to '#{target}'."
target.dirname.mkpath
if target.dirname.parent.writable?
target.dirname.mkpath
else
command.run!("/bin/mkdir", args: ["-p", target.dirname], sudo: true)
end
if target.parent.writable?
FileUtils.move(source, target)