Use a CDATA section for preferences in replays

This commit is contained in:
2024-08-10 15:32:56 -04:00
parent 4d4ab09395
commit 33f7562bfc
5 changed files with 11 additions and 5 deletions

View File

@@ -206,7 +206,7 @@ bool sync_prefs() {
prefs_recording << std::endl;
}
}
record_action("load_prefs", prefs_recording.str());
record_action("load_prefs", prefs_recording.str(), true);
prefsLoaded = true;
}else if(replaying && !prefsLoaded){
replayUserDefaults = [[NSUserDefaults alloc] init];

View File

@@ -150,7 +150,7 @@ static bool load_prefs(std::istream& in) {
prefs.swap(temp_prefs);
if (recording) {
record_action("load_prefs", prefs_recording.str());
record_action("load_prefs", prefs_recording.str(), true);
}
return prefsLoaded = true;

View File

@@ -60,10 +60,11 @@ bool init_action_log(std::string command, std::string file) {
return false;
}
void record_action(std::string action_type, std::string inner_text) {
void record_action(std::string action_type, std::string inner_text, bool cdata) {
Element* root = log_document.FirstChildElement();
Element next_action(action_type);
Text action_text(inner_text);
action_text.SetCDATA(cdata);
next_action.InsertEndChild(action_text);
root->InsertEndChild(next_action);
log_document.SaveFile(log_file);
@@ -151,4 +152,4 @@ short short_from_action(Element& action) {
std::istringstream sstr(action.GetText());
sstr >> s;
return s;
}
}

View File

@@ -15,7 +15,7 @@ extern bool recording;
extern bool replaying;
extern bool init_action_log(std::string command, std::string file);
extern void record_action(std::string action_type, std::string inner_text);
extern void record_action(std::string action_type, std::string inner_text, bool cdata = false);
extern void record_action(std::string action_type, std::map<std::string,std::string> info);
extern bool has_next_action();
extern std::string next_action_type();