Module: Importable
Overview
Importable class
this module is included by Import_C and Import
Instance Method Summary collapse
-
#find_file(file) ⇒ Object
Importable#find_file file::String : file name to find return::String | Nil: path to file or nil if not found find file in.
- #get_base_dir ⇒ Object
Instance Method Details
#find_file(file) ⇒ Object
Importable#find_file
file::String : file name to find return::String | Nil: path to file or nil if not found find file in
7253 7254 7255 7256 7257 7258 7259 7260 7261 7262 7263 7264 7265 7266 7267 7268 7269 7270 7271 7272 7273 7274 7275 7276 7277 7278 7279 7280 7281 7282 7283 7284 7285 7286 7287 7288 7289 7290 7291 7292 7293 7294 7295 7296 |
# File 'lib/tecsgen/core/componentobj.rb', line 7253 def find_file(file) $import_path.each{|path| if path == "." pt = file else pt = "#{path}/#{file}" end if File.exist?(pt) if !$base_dir[Dir.pwd] $base_dir[Dir.pwd] = true end if $verbose print "#{file} is found in #{path}\n" end @last_base_dir = nil dbgPrint "base_dir=. while searching #{file}\n" return pt end } $base_dir.each_key{|bd| $import_path.each{|path| pt = "#{path}/#{file}" begin Dir.chdir $run_dir Dir.chdir bd if File.exist?(pt) if $verbose print "#{file} is found in #{bd}/#{path}\n" end @last_base_dir = bd dbgPrint "base_dir=#{bd} while searching #{file}\n" $base_dir[bd] = true return pt end rescue # TODO Add debug print to display exception end } } @last_base_dir = nil dbgPrint "base_dir=. while searching #{file}\n" return nil end |
#get_base_dir ⇒ Object
7298 7299 7300 7301 7302 7303 7304 7305 7306 |
# File 'lib/tecsgen/core/componentobj.rb', line 7298 def get_base_dir return @last_base_dir $base_dir.each{|bd, flag| if flag == true return bd end } return nil end |