Last active
December 23, 2015 05:59
-
-
Save TakashiNakagawa/6590762 to your computer and use it in GitHub Desktop.
opencvのincludeファイルコピー
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "find" | |
require "fileutils" | |
def copy(source_path, target_path) | |
Find.find(source_path) do |source| | |
next if File.directory? source | |
#パスにopencv2が含まれていなければ除外 | |
next unless File.dirname(source).include?("opencv2") | |
#拡張子がh, hppのみ対象 | |
next unless [".hpp", ".h"].include?(File.extname(source)) | |
#コピー先名はinclude/opencv2/module_name/header | |
module_name = File.split(source)[0].split("/").last | |
target = target_path+"include/opencv2/"+module_name | |
FileUtils.mkdir_p target unless File.exists? target | |
FileUtils.copy source, target | |
end | |
end | |
source_path = ARGV[0] | |
target_path = ARGV[1] | |
copy(source_path, target_path) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment