2017-03-28 15:34:34 +02:00
|
|
|
require "hbc/container/naked"
|
2017-05-07 17:28:39 +01:00
|
|
|
require "vendor/macho/macho"
|
2017-03-28 15:34:34 +02:00
|
|
|
|
|
|
|
module Hbc
|
|
|
|
class Container
|
|
|
|
class Executable < Naked
|
|
|
|
def self.me?(criteria)
|
|
|
|
return true if criteria.magic_number(/^#!\s*\S+/)
|
|
|
|
|
|
|
|
begin
|
2017-07-01 17:57:39 +02:00
|
|
|
criteria.path.file? && MachO.open(criteria.path).header.executable?
|
2017-03-28 15:34:34 +02:00
|
|
|
rescue MachO::MagicError
|
|
|
|
false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|