lib/ffprober.rb in ffprober-0.2.3 vs lib/ffprober.rb in ffprober-0.3.0
- old
+ new
@@ -8,18 +8,20 @@
require "json"
module Ffprober
def self.path
name = 'ffprobe'
+ name << '.exe' if self.windows?
- if File.executable? name
- cmd
- else
- path = ENV['PATH'].split(File::PATH_SEPARATOR).find { |path|
- File.executable? File.join(path, name)
- }
- path && File.expand_path(name, path)
+ path = ENV['PATH'].split(File::PATH_SEPARATOR).find do |path|
+ File.executable?(File.join(path, name))
end
+
+ path && File.expand_path(name, path)
+ end
+
+ def self.windows?
+ !!(RUBY_PLATFORM =~ /(mingw|mswin)/)
end
class InvalidInputFileError < ::StandardError; end
end