bool AEEditorPrefs::CreateDefaultPreferences(String& path, JSONValue& prefs)
    {
        // Note there is some duplication here with the editor's
        // TypeScript preference code, this is due to the preferences for
        // the editor window needing to be available at window creation time
        // It could be better to split this all out to a native, scriptable
        // preferences object

        ATOMIC_LOGINFOF("Creating default Atomic Editor preferences: %s", path.CString());

        SharedPtr<JSONFile> jsonFile(new JSONFile(context_));

        JSONValue& root = jsonFile->GetRoot();

        root.Clear();
        root["recentProjects"] = JSONArray();

        JSONValue editorWindow;
        GetDefaultWindowPreferences(editorWindow, true);

        JSONValue playerWindow;
        GetDefaultWindowPreferences(playerWindow, false);

        root["editorWindow"] = editorWindow;
        root["playerWindow"] = playerWindow;

        prefs = root;

        SavePreferences(prefs);

        return true;
    }
Example #2
0
ArrayMutation::ArrayMutation(bool create_empty)
{
    if ( create_empty )
    {
        becomeObject();
        toObject().setAttribute("$array", JSONArray(true));
    }
}