Sha256: f60d546d7a0fba65d099d373d2119d95281cc59b9a19ad085f4a5ff743b91264

Contents?: true

Size: 787 Bytes

Versions: 1

Compression:

Stored size: 787 Bytes

Contents

module YoutubeDL
  module Support
    # Some support methods and glue logic.

    # Returns a usable youtube-dl executable (system or vendor)
    #
    # @param exe [String] Executable to search for
    # @return [String] executable path
    def usable_executable_path_for(exe)
      system_path = `which #{exe} 2> /dev/null` # This will currently only work on Unix systems. TODO: Add Windows support
      if $?.exitstatus == 0 # $? is an object with information on that last command run with backticks.
        system_path.strip
      else
        vendor_path = File.absolute_path("#{__FILE__}/../../../vendor/bin/#{exe}")
        File.chmod(775, vendor_path) unless File.executable?(vendor_path) # Make sure vendor binary is executable
        vendor_path
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
youtube-dl.rb-0.1.0 lib/youtube-dl/support.rb