MCPcopy Create free account
hub / github.com/LibreSprite/LibreSprite / saveAs

Method saveAs

src/app/script/api/sprite_script.cpp:162–173  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

160 }
161
162 void saveAs(const std::string& fileName, bool asCopy) {
163 commit();
164 if (fileName.empty()) asCopy = false;
165 auto uiCtx = app::UIContext::instance();
166 uiCtx->setActiveDocument(doc());
167 auto commandName = asCopy ? app::CommandId::SaveFileCopyAs : app::CommandId::SaveFile;
168 auto saveCommand = app::CommandsModule::instance()->getCommandByName(commandName);
169 app::Params params;
170 if (asCopy) params.set("filename", fileName.c_str());
171 else if(!fileName.empty()) doc()->setFilename(fileName);
172 uiCtx->executeCommand(saveCommand, params);
173 }
174
175 void loadPalette(const std::string& fileName){
176 auto palette = app::load_palette(fileName.c_str());

Callers 1

initializeMethod · 0.80

Calls 7

instanceFunction · 0.85
setActiveDocumentMethod · 0.80
getCommandByNameMethod · 0.80
executeCommandMethod · 0.80
emptyMethod · 0.45
setMethod · 0.45
setFilenameMethod · 0.45

Tested by

no test coverage detected