Top Level Namespace

Defined Under Namespace

Modules: Archive_r

Instance Method Summary collapse

Instance Method Details

#archive_r_core_rootObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'ext/archive_r/extconf.rb', line 6

def archive_r_core_root
  candidates = []

  env_root = ENV['ARCHIVE_R_CORE_ROOT']
  candidates << File.expand_path(env_root) if env_root && !env_root.empty?

  repo_root = File.expand_path('../../../..', __dir__)
  candidates << repo_root

  vendor_root = File.expand_path('vendor/archive_r', __dir__)
  candidates << vendor_root

  candidates.each do |root|
    next unless root
    include_dir = File.join(root, 'include')
    src_dir = File.join(root, 'src')
    return root if Dir.exist?(include_dir) && Dir.exist?(src_dir)
  end

  nil
end