MCPcopy Create free account
hub / github.com/OpenDDS/OpenDDS / make_new_file

Method make_new_file

dds/DCPS/FileSystemStorage.cpp:554–572  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

552}
553
554File::Ptr Directory::make_new_file(const ACE_TString& t_name)
555{
556 if (dirs_.find(t_name) != dirs_.end()) {
557 throw std::runtime_error("Can't create a file with the same name as "
558 "an existing directory.");
559 }
560
561 ACE_TString phys = add_entry() + b32h_encode(t_name.c_str());
562 files_[t_name] = phys;
563
564 CwdGuard cg(physical_dirname_);
565 // touch the file since the user has asked to create it
566 std::FILE* fh = std::fopen(ACE_TEXT_ALWAYS_CHAR(phys.c_str()), "w");
567
568 if (!fh) throw std::runtime_error("Can't create the file");
569
570 std::fclose(fh);
571 return DCPS::make_rch<File>(physical_dirname_ + phys, t_name, rchandle_from(this));
572}
573
574File::Ptr Directory::create_next_file()
575{

Callers

nothing calls this directly

Calls 4

b32h_encodeFunction · 0.85
rchandle_fromFunction · 0.85
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected