MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / write

Method write

Engine/source/persistence/taml/taml.cpp:207–250  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

205 //-----------------------------------------------------------------------------
206
207 bool Taml::write(SimObject* pSimObject, const char* pFilename)
208 {
209 // Debug Profiling.
210 PROFILE_SCOPE(Taml_Write);
211
212 // Sanity!
213 AssertFatal(pSimObject != NULL, "Cannot write a NULL object.");
214 AssertFatal(pFilename != NULL, "Cannot write to a NULL filename.");
215
216 // Expand the file-name into the file-path buffer unless we're a secure VFS
217#ifndef TORQUE_SECURE_VFS
218 Con::expandToolScriptFilename(mFilePathBuffer, sizeof(mFilePathBuffer), pFilename);
219#else
220 dMemset(mFilePathBuffer, 0x00, sizeof(mFilePathBuffer));
221 dMemcpy(mFilePathBuffer, pFilename, dStrlen(pFilename));
222#endif
223
224 FileStream stream;
225
226 // File opened?
227 if (!stream.open(mFilePathBuffer, Torque::FS::File::Write))
228 {
229 // No, so warn.
230 Con::warnf("Taml::writeFile() - Could not open filename '%s' for write.", mFilePathBuffer);
231 return false;
232 }
233
234 // Get the file auto-format mode.
235 const TamlFormatMode formatMode = getFileAutoFormatMode(mFilePathBuffer);
236
237 // Reset the compilation.
238 resetCompilation();
239
240 // Write object.
241 const bool status = write(stream, pSimObject, formatMode);
242
243 // Close file.
244 stream.close();
245
246 // Reset the compilation.
247 resetCompilation();
248
249 return status;
250 }
251
252 //-----------------------------------------------------------------------------
253

Callers 4

dumpShaderDisassemblyMethod · 0.45
WriteMethod · 0.45
PutcMethod · 0.45

Calls 8

expandToolScriptFilenameFunction · 0.85
openMethod · 0.65
closeMethod · 0.65
dMemsetFunction · 0.50
dMemcpyFunction · 0.50
dStrlenFunction · 0.50
warnfFunction · 0.50
writeFunction · 0.50

Tested by

no test coverage detected