MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / Save

Method Save

Source/Engine/Content/JsonAsset.cpp:168–190  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

166}
167
168bool JsonAssetBase::Save(const StringView& path)
169{
170 if (OnCheckSave(path))
171 return true;
172 PROFILE_CPU();
173 ScopeLock lock(Locker);
174
175 // Serialize to json to the buffer
176 rapidjson_flax::StringBuffer buffer;
177 PrettyJsonWriter writerObj(buffer);
178 _isResaving = true;
179 saveInternal(writerObj);
180 _isResaving = false;
181
182 // Save json to file
183 if (File::WriteAllBytes(path.HasChars() ? path : GetPath(), (byte*)buffer.GetString(), (int32)buffer.GetSize()))
184 {
185 LOG(Error, "Cannot save \'{0}\'", ToString());
186 return true;
187 }
188
189 return false;
190}
191
192bool JsonAssetBase::Save(JsonWriter& writer) const
193{

Callers

nothing calls this directly

Calls 5

GetPathFunction · 0.85
ToStringFunction · 0.50
HasCharsMethod · 0.45
GetStringMethod · 0.45
GetSizeMethod · 0.45

Tested by

no test coverage detected