Create parent trusted list path before writing

This makes sure that $HOME/.local/share/nix exists before we try to
write to it.
This commit is contained in:
Matthew Bauer 2021-05-08 21:31:28 -05:00
parent fe3a10a9b2
commit 2f63cc02de

View file

@ -22,7 +22,9 @@ static TrustedList readTrustedList()
static void writeTrustedList(const TrustedList & trustedList) static void writeTrustedList(const TrustedList & trustedList)
{ {
writeFile(trustedListPath(), nlohmann::json(trustedList).dump()); auto path = trustedListPath();
createDirs(dirOf(path));
writeFile(path, nlohmann::json(trustedList).dump());
} }
void ConfigFile::apply() void ConfigFile::apply()