lib/bake/util.rb in bake-toolkit-1.0.19 vs lib/bake/util.rb in bake-toolkit-1.0.20
- old
+ new
@@ -94,5 +94,32 @@
# You don't want all _ :)
name.gsub!(/[^0-9A-Za-z.\-]/, 'x')
end
end
+def searchRootsFile(dir)
+ rootsFile = dir+"/roots.bake"
+ return rootsFile if File.exist?(rootsFile)
+
+ parent = File.dirname(dir)
+ return searchRootsFile(parent) if parent != dir
+
+ return nil
+end
+
+def calc_def_roots(dir)
+ def_roots = []
+ rootsFile = searchRootsFile(dir)
+ if (rootsFile)
+ File.open(rootsFile).each do |line|
+ line.gsub!(/[\\]/,'/')
+ if File.is_absolute?(line)
+ def_roots << line
+ else
+ def_roots << File.dirname(rootsFile) + "/" + line
+ end
+ end
+ else
+ def_roots << File.dirname(dir)
+ end
+ def_roots
+end