/** * {@inheritdoc} */ public function getValue($key) { $parser = new JsonParser(); $plist = $this->getStoragePath(); $value = Util::run("defaults read \"{$plist}\" {$key}"); try { $parser->lint($json); return $parser->parse($json); } catch (Exception $e) { throw $e; } }
/** * Instantiates the class. * * @param string $bundle_id The bundle ID to give to the workflow. */ public function __construct($bundle_id) { $fs = new Filesystem(); $this->path = Util::run('pwd'); $this->home = Util::run('printf $HOME'); $this->bundle = $bundle_id; if (!is_null($bundle_id)) { $this->bundle = $bundle_id; } $this->cache = $this->home . self::CACHE_PATH . '/' . $this->bundle; $this->data = $this->home . self::DATA_PATH . '/' . $this->bundle; if (!file_exists($this->cache)) { $fs->mkdir($this->cache); } if (!file_exists($this->data)) { $fs->mkdir($this->data); } }
/** * Search the local drive using `mdfind`. * * @param string $query The file pattern to find. * @return array An array of file system paths containing matches. */ public function mdfind($query) { return explode(PHP_EOL, Util::run("mdfind \"{$query}\"")); }