lib/origen/site_config.rb
# NOTE: Gems are not allowed to be required here, only Ruby stlibs
Gems are not allowed to be required here, only Ruby stlibs
Gems are not allowed to be required here only Ruby stlibs
def eval_path(path, options = {})
      path = path.sub(/^~/, File.expand_path('~/'))
      path.gsub!(/(?<!\\|\A)~/, "#{Etc.getlogin}")
      path.gsub!(/\\(?=~)/, '')
      if path.start_with?('~')
        path = File.expand_path(path).sub(/^#{Regexp.quote(File.expand_path('~/'))}/, '~')
      else
        path = File.expand_path(path)
      end
      append = find_val('append_dot_origen')
      append = '.origen' if append == true || append.nil?
      gem_append = find_val('append_gems')
      gem_append = 'gems' if gem_append == true || gem_append.nil?
      if append
        unless path.end_with?(append) || (path.end_with?(File.join(append, gem_append)) if gem_append)
          path = File.join(path, append)
        end
      end
      path
    end
def eval_path ( path , options = { } ) path = path . sub ( / ^~ / , File . expand_path ( '~/' ) ) path . gsub! ( / (?<! \\ | \A )~ / , "#{Etc.getlogin}" ) path . gsub! ( / \\ (?=~) / , '' ) if path . start_with? ( '~' ) path = File . expand_path ( path ) . sub ( / ^ #{ Regexp . quote ( File . expand_path ( '~/' ) ) } / , '~' ) else path = File . expand_path ( path ) end append = find_val ( 'append_dot_origen' ) append = '.origen' if append == true || append . nil? gem_append = find_val ( 'append_gems' ) gem_append = 'gems' if gem_append == true || gem_append . nil? if append unless path . end_with? ( append ) || ( path . end_with? ( File . join ( append , gem_append ) ) if gem_append ) path = File . join ( path , append ) end end path end
NOTE: Gems are not allowed to be required here, only Ruby stlibs
NOTE : Gems are not allowed to be required here only Ruby stlibs
# Any leading ~ should be expanded with whatever ~/ points to. This needs to be done now because later ~ will be replaced with just the username. # Gsub the remaining ~ that aren't escaped. # If it was escaped, eat the escape character # Now, expand the entire path for any other OS-specific symbols. # One note, if we still have a leading '~', that means it was escaped at the beginning. So, what we'll do for this is let it expand # then replace the leading File.expand_path('~/') with just '~', pretty much the opposite of path.sub(/^~/, File.expand_path('~/')) # Note, we can't just take it out, expand, then add it back  because expanding the path on Windows will expand to # C:\, or D:\ or whatever, so need to do this 'expand, then unexpand' method.
path
<not_specific>
options
<not_specific>