Class: Ffprober::Ffmpeg::Finder

Inherits:
Object
  • Object
show all
Defined in:
lib/ffprober/ffmpeg/finder.rb

Constant Summary collapse

SEARCH_PATHS =
ENV['PATH']

Class Method Summary collapse

Class Method Details

.executable_nameObject



13
14
15
# File 'lib/ffprober/ffmpeg/finder.rb', line 13

def self.executable_name
  @executable_name ||= windows? ? 'ffprobe.exe' : 'ffprobe'
end

.executable_pathObject



21
22
23
24
25
26
27
# File 'lib/ffprober/ffmpeg/finder.rb', line 21

def self.executable_path
  @executable_path ||= begin
    SEARCH_PATHS.split(File::PATH_SEPARATOR).detect do |path_to_check|
      File.executable?(File.join(path_to_check, executable_name))
    end
  end
end

.pathObject



8
9
10
11
# File 'lib/ffprober/ffmpeg/finder.rb', line 8

def self.path
  raise Ffprober::NoFfprobeFound if executable_path.nil?
  @path ||= File.expand_path(executable_name, executable_path)
end

.windows?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/ffprober/ffmpeg/finder.rb', line 17

def self.windows?
  !(RUBY_PLATFORM =~ /(mingw|mswin)/).nil?
end