module BlackStack::OCRA
OCRA
Supporting Functions
Public Class Methods
require_in_working_path(filename, path, show_path_info=false)
click to toggle source
OCRA
files run into a temp folder, where the script is unpacked.
This function is useful to require a configuration file when the script is running inside an OCRA
temp folder, since the local folder of the running command is not the filder where the exe file is hosted.
More information:
* https://stackoverflow.com/questions/1937743/how-to-get-the-current-working-directorys-absolute-path-from-irb
-
stackoverflow.com/questions/8577223/ruby-get-the-file-being-executed
-
stackoverflow.com/questions/7399882/ruby-getting-path-from-pathfilename/7400057
# File lib/functions.rb, line 19 def self.require_in_working_path(filename, path, show_path_info=false) puts '' if show_path_info path = File.expand_path File.dirname(path) #path = Dir.pwd puts "require_in_working_path.path:#{path}:." if show_path_info file = "#{path}/#{filename}" puts "require_in_working_path.file:#{file}:." if show_path_info require file end