Merge pull request #4041 from cole-h/enum-stringify
Serialize SandboxMode enum to string for JSON
This commit is contained in:
commit
7dd8baafe1
|
@ -147,6 +147,12 @@ bool Settings::isWSL1()
|
||||||
|
|
||||||
const string nixVersion = PACKAGE_VERSION;
|
const string nixVersion = PACKAGE_VERSION;
|
||||||
|
|
||||||
|
NLOHMANN_JSON_SERIALIZE_ENUM(SandboxMode, {
|
||||||
|
{SandboxMode::smEnabled, true},
|
||||||
|
{SandboxMode::smRelaxed, "relaxed"},
|
||||||
|
{SandboxMode::smDisabled, false},
|
||||||
|
});
|
||||||
|
|
||||||
template<> void BaseSetting<SandboxMode>::set(const std::string & str)
|
template<> void BaseSetting<SandboxMode>::set(const std::string & str)
|
||||||
{
|
{
|
||||||
if (str == "true") value = smEnabled;
|
if (str == "true") value = smEnabled;
|
||||||
|
|
Loading…
Reference in a new issue