MCPcopy Create free account
hub / github.com/OGRECave/ogre / create

Method create

OgreMain/src/OgreFileSystem.cpp:408–439  ·  view source on GitHub ↗

---------------------------------------------------------------------

Source from the content-addressed store, hash-verified

406 }
407 //---------------------------------------------------------------------
408 DataStreamPtr FileSystemArchive::create(const String& filename)
409 {
410 if (isReadOnly())
411 {
412 OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS, "Cannot create a file in a read-only archive");
413 }
414
415 String full_path = concatenate_path(mName, filename);
416
417 // Always open in binary mode
418 // Also, always include reading
419 std::ios::openmode mode = std::ios::out | std::ios::binary;
420 std::fstream* rwStream = OGRE_NEW_T(std::fstream, MEMCATEGORY_GENERAL)();
421#ifdef _OGRE_FILESYSTEM_ARCHIVE_UNICODE
422 rwStream->open(to_wpath(full_path).c_str(), mode);
423#else
424 rwStream->open(full_path.c_str(), mode);
425#endif
426
427 // Should check ensure open succeeded, in case fail for some reason.
428 if (rwStream->fail())
429 {
430 OGRE_DELETE_T(rwStream, basic_fstream, MEMCATEGORY_GENERAL);
431 OGRE_EXCEPT(Exception::ERR_FILE_NOT_FOUND, "Cannot open file: " + filename);
432 }
433
434 /// Construct return stream, tell it to delete on destroy
435 FileStreamDataStream* stream = OGRE_NEW FileStreamDataStream(filename,
436 rwStream, 0, true);
437
438 return DataStreamPtr(stream);
439 }
440 //---------------------------------------------------------------------
441 void FileSystemArchive::remove(const String& filename)
442 {

Callers

nothing calls this directly

Calls 4

isReadOnlyFunction · 0.85
concatenate_pathFunction · 0.85
to_wpathFunction · 0.85
openMethod · 0.45

Tested by

no test coverage detected