- def prepare_tmpdirs(data)
- data[:files].each do |file|
- targetdir = File.join(@tmpdir, "#{@current_package_name}-#{@plugin.metadata[:version]}", @libdir, File.dirname(File.expand_path(file)).gsub(@plugin.target_path, ""))
- FileUtils.mkdir_p(targetdir) unless File.directory? targetdir
- FileUtils.cp_r(file, targetdir)
+ # Move files contained in the plugin to the correct directory
+ # relative to the build root.
+ def prepare_tmpdirs
+ plugin_files.each do |file|
+ begin
+ targetdir = File.join(@tmpdir, @package_name_and_version, @libdir, File.dirname(File.expand_path(file)).gsub(@plugin.target_path, ""))
+ FileUtils.mkdir_p(targetdir) unless File.directory?(targetdir)
+ FileUtils.cp_r(file, targetdir)
+ rescue Errno::EACCES => e
+ puts "Could not create directory '#{targetdir}'. Permission denied"
+ raise e
+ rescue Errno::ENOENT => e
+ puts "Could not copy file '#{file}' to '#{targetdir}'. File does not exist"
+ raise e
+ rescue => e
+ puts 'Could not prepare temporary build directory'
+ raise e
+ end