MCPcopy Create free account
hub / github.com/TypesettingTools/Aegisub / Save

Method Save

src/subs_controller.cpp:200–225  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

198}
199
200void SubsController::Save(agi::fs::path const& filename, const char *encoding) {
201 const SubtitleFormat *writer = SubtitleFormat::GetWriter(filename);
202 if (!writer)
203 throw agi::InvalidInputException("Unknown file type.");
204
205 int old_autosaved_commit_id = autosaved_commit_id, old_saved_commit_id = saved_commit_id;
206 try {
207 autosaved_commit_id = saved_commit_id = commit_id;
208
209 // Have to set this now for the sake of things that want to save paths
210 // relative to the script in the header
211 this->filename = filename;
212 context->path->SetToken("?script", filename.parent_path());
213
214 context->ass->CleanExtradata();
215 writer->WriteFile(context->ass.get(), filename, 0, encoding);
216 FileSave();
217 }
218 catch (...) {
219 autosaved_commit_id = old_autosaved_commit_id;
220 saved_commit_id = old_saved_commit_id;
221 throw;
222 }
223
224 SetFileName(filename);
225}
226
227void SubsController::Close() {
228 undo_stack.clear();

Callers 8

UpdateStorageMethod · 0.45
LoadCatalogMethod · 0.45
WriteFileMethod · 0.45
get_export_configFunction · 0.45
UnhandledExceptionMethod · 0.45
save_subtitlesFunction · 0.45
operator()Function · 0.45
TESTFunction · 0.45

Calls 4

SetTokenMethod · 0.80
CleanExtradataMethod · 0.80
WriteFileMethod · 0.45
getMethod · 0.45

Tested by 1

TESTFunction · 0.36