MCPcopy Create free account
hub / github.com/XorTroll/Goldleaf / StartFileImpl

Method StartFileImpl

Goldleaf/source/fs/fs_StdExplorer.cpp:160–188  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

158 }
159
160 void StdExplorer::StartFileImpl(const std::string &path, const FileMode mode) {
161 auto file_mode = "rw";
162 switch(mode) {
163 case FileMode::Read: {
164 file_mode = "rb";
165 break;
166 }
167 case FileMode::Write: {
168 file_mode = "wb";
169 break;
170 }
171 case FileMode::Append: {
172 file_mode = "ab+";
173 break;
174 }
175 default: {
176 GLEAF_ASSERT_FAIL("Invalid file mode");
177 }
178 }
179
180 const auto full_path = this->MakeFull(path);
181 auto file_obj = fopen(full_path.c_str(), file_mode);
182 if(mode == FileMode::Read) {
183 this->r_file_obj = file_obj;
184 }
185 else {
186 this->w_file_obj = file_obj;
187 }
188 }
189
190 void StdExplorer::EndFileImpl(const FileMode mode) {
191 switch(mode) {

Callers 1

StartFileMethod · 0.45

Calls 1

MakeFullMethod · 0.80

Tested by

no test coverage detected