}
public function writeLocalArcConfig(array $config) {
+ $json_encoder = new PhutilJSON();
+ $json = $json_encoder->encodeFormatted($config);
+
$dir = $this->localMetaDir;
if (!strlen($dir)) {
- return false;
+ throw new Exception(pht('No working copy to write config into!'));
}
- if (!Filesystem::pathExists($dir)) {
- try {
- Filesystem::createDirectory($dir);
- } catch (Exception $ex) {
- return false;
- }
- }
-
- $json_encoder = new PhutilJSON();
- $json = $json_encoder->encodeFormatted($config);
-
- $config_file = Filesystem::resolvePath('arc/config', $dir);
- try {
- Filesystem::writeFile($config_file, $json);
- } catch (FilesystemException $ex) {
- return false;
+ $local_dir = $dir.DIRECTORY_SEPARATOR.'arc';
+ if (!Filesystem::pathExists($local_dir)) {
+ Filesystem::createDirectory($local_dir, 0755);
}
- return true;
+ $config_file = $local_dir.DIRECTORY_SEPARATOR.'config';
+ Filesystem::writeFile($config_file, $json);
}
}