os/mac: move legacy functions to compat
This commit is contained in:
parent
9fcaa46cdf
commit
c70bb474e3
@ -4,3 +4,4 @@ require "compat/cask/dsl/version"
|
|||||||
require "compat/language/python"
|
require "compat/language/python"
|
||||||
require "compat/requirements/macos_requirement"
|
require "compat/requirements/macos_requirement"
|
||||||
require "compat/formula"
|
require "compat/formula"
|
||||||
|
require "compat/os/mac" if OS.mac?
|
||||||
|
|||||||
30
Library/Homebrew/compat/os/mac.rb
Normal file
30
Library/Homebrew/compat/os/mac.rb
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module OS
|
||||||
|
module Mac
|
||||||
|
class << self
|
||||||
|
module Compat
|
||||||
|
def preferred_arch
|
||||||
|
# odeprecated "MacOS.preferred_arch", "Hardware::CPU.arch (or ideally let the compiler handle it)"
|
||||||
|
if Hardware::CPU.is_64_bit?
|
||||||
|
Hardware::CPU.arch_64_bit
|
||||||
|
else
|
||||||
|
Hardware::CPU.arch_32_bit
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def tcc_db
|
||||||
|
# odeprecated "MacOS.tcc_db"
|
||||||
|
@tcc_db ||= Pathname.new("/Library/Application Support/com.apple.TCC/TCC.db")
|
||||||
|
end
|
||||||
|
|
||||||
|
def pre_mavericks_accessibility_dotfile
|
||||||
|
# odeprecated "MacOS.pre_mavericks_accessibility_dotfile"
|
||||||
|
@pre_mavericks_accessibility_dotfile ||= Pathname.new("/private/var/db/.AccessibilityAPIEnabled")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
prepend Compat
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@ -166,14 +166,6 @@ module OS
|
|||||||
paths.uniq
|
paths.uniq
|
||||||
end
|
end
|
||||||
|
|
||||||
def preferred_arch
|
|
||||||
if Hardware::CPU.is_64_bit?
|
|
||||||
Hardware::CPU.arch_64_bit
|
|
||||||
else
|
|
||||||
Hardware::CPU.arch_32_bit
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def app_with_bundle_id(*ids)
|
def app_with_bundle_id(*ids)
|
||||||
path = mdfind(*ids)
|
path = mdfind(*ids)
|
||||||
.reject { |p| p.include?("/Backups.backupdb/") }
|
.reject { |p| p.include?("/Backups.backupdb/") }
|
||||||
@ -196,13 +188,5 @@ module OS
|
|||||||
def mdfind_query(*ids)
|
def mdfind_query(*ids)
|
||||||
ids.map! { |id| "kMDItemCFBundleIdentifier == #{id}" }.join(" || ")
|
ids.map! { |id| "kMDItemCFBundleIdentifier == #{id}" }.join(" || ")
|
||||||
end
|
end
|
||||||
|
|
||||||
def tcc_db
|
|
||||||
@tcc_db ||= Pathname.new("/Library/Application Support/com.apple.TCC/TCC.db")
|
|
||||||
end
|
|
||||||
|
|
||||||
def pre_mavericks_accessibility_dotfile
|
|
||||||
@pre_mavericks_accessibility_dotfile ||= Pathname.new("/private/var/db/.AccessibilityAPIEnabled")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user