Page MenuHomeSealhub

No OneTemporary

diff --git a/src/config/source/ArcanistFilesystemConfigurationSource.php b/src/config/source/ArcanistFilesystemConfigurationSource.php
index ffcb5016..4281c830 100644
--- a/src/config/source/ArcanistFilesystemConfigurationSource.php
+++ b/src/config/source/ArcanistFilesystemConfigurationSource.php
@@ -1,45 +1,58 @@
<?php
abstract class ArcanistFilesystemConfigurationSource
extends ArcanistDictionaryConfigurationSource {
private $path;
public function __construct($path) {
$this->path = $path;
$values = array();
if (Filesystem::pathExists($path)) {
$contents = Filesystem::readFile($path);
if (strlen(trim($contents))) {
$values = phutil_json_decode($contents);
}
}
$values = $this->didReadFilesystemValues($values);
parent::__construct($values);
}
public function getPath() {
return $this->path;
}
public function getSourceDisplayName() {
return pht('%s (%s)', $this->getFileKindDisplayName(), $this->getPath());
}
abstract public function getFileKindDisplayName();
protected function didReadFilesystemValues(array $values) {
return $values;
}
protected function writeToStorage($values) {
$content = id(new PhutilJSON())
->encodeFormatted($values);
- Filesystem::writeFile($this->path, $content);
+ $path = $this->path;
+
+ // If the containing directory does not exist yet, create it.
+ //
+ // This is expected when (for example) you first write to project
+ // configuration in a Git working copy: the ".git/arc" directory will
+ // not exist yet.
+
+ $dir = dirname($path);
+ if (!Filesystem::pathExists($dir)) {
+ Filesystem::createDirectory($dir, 0755, $recursive = true);
+ }
+
+ Filesystem::writeFile($path, $content);
}
}

File Metadata

Mime Type
text/x-diff
Expires
Sat, Oct 11, 07:31 (1 d, 6 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
983977
Default Alt Text
(1 KB)

Event Timeline