MCPcopy Create free account
hub / github.com/Norbyte/bg3se / SaveExternalFile

Function SaveExternalFile

BG3Extender/Extender/Shared/ScriptHelpers.cpp:110–125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

108}
109
110bool SaveExternalFile(std::string_view path, PathRootType root, StringView contents)
111{
112 auto absolutePath = GetPathForExternalIo(path, root);
113 if (!absolutePath) return false;
114
115 if (!CreateParentDirectoryRecursive(*absolutePath)) return false;
116
117 std::ofstream f(absolutePath->c_str(), std::ios::out | std::ios::binary);
118 if (!f.good()) {
119 OsiError("Could not open file for writing: '" << path << "'");
120 return false;
121 }
122
123 f.write(contents.data(), contents.length());
124 return true;
125}
126
127}

Callers

nothing calls this directly

Calls 3

GetPathForExternalIoFunction · 0.85
dataMethod · 0.45

Tested by

no test coverage detected