Last active
May 9, 2016 03:24
-
-
Save komiyake/fa73b9e4eb85055e2566 to your computer and use it in GitHub Desktop.
RescueのMapに存在するconfigファイルの編集を指定したディレクトリから再帰的に行う。
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
#! ruby -Ks | |
# coding: utf-8 | |
require 'pp' | |
require 'find' | |
DIRROOT=ARGV[0] | |
Dir.chdir(DIRROOT) | |
Find.find(DIRROOT) do |f| | |
if not File.directory?(f) | |
file = open(File.dirname(f) + "/" + File.basename(f), "r") | |
buffer = file.read | |
if File.basename(f) == "gis.cfg" | |
dir = File.dirname(f).split("/") | |
#Mapをmaps/maps2013に置くと指定 | |
buffer.gsub!(/maps\/maps2013.*$/, "maps/maps2013/" + dir[dir.length-2] + "/map") | |
elsif File.basename(f) == "kernel-inline.cfg" | |
buffer.gsub!(/^kernel.agents.auto/, "#kernel.agents.auto") | |
buffer.gsub!(/^#kernel.agents.auto .. sample.SampleCivilian.n/, "kernel.agents.auto +: sample.SampleCivilian*n") | |
end | |
file = open(File.dirname(f) + "/" + File.basename(f), "w") | |
file.write(buffer) | |
file.close | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment