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

Method save

src/app/script/api/storage_script.cpp:100–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98 }
99
100 std::string save(const std::string& key, const std::string& domain) {
101 auto domainIt = storage.find(domain.empty() ? app::AppScripting::getFileName() : domain);
102 if (domainIt == storage.end()) return "";
103 auto entryIt = domainIt->second.find(key);
104 if (entryIt == domainIt->second.end()) return "";
105 try {
106 auto path = this->path(key, domain);
107 base::FileHandle handle(base::open_file_with_exception(path, "wb"));
108 auto str = entryIt->second.str();
109 fwrite(str.c_str(), str.size(), 1, handle.get());
110 return path;
111 } catch(...) {
112 return "";
113 }
114 return "";
115 }
116
117 bool decodeBase64(const std::string& key, const std::string& domain) {
118 auto domainIt = storage.find(domain.empty() ? app::AppScripting::getFileName() : domain);

Callers

nothing calls this directly

Calls 7

pathMethod · 0.95
open_file_with_exceptionFunction · 0.85
emptyMethod · 0.45
endMethod · 0.45
strMethod · 0.45
sizeMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected