MCPcopy Create free account
hub / github.com/Tencent/phxqueue / ExtractFilePath

Function ExtractFilePath

phxqueue/comm/utils/file_util.cpp:156–175  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

154
155
156int ExtractFilePath(const string &file_path, string *dir, string *file_name) {
157 const auto pos(file_path.find_last_of("/"));
158 if (string::npos == pos) {
159 if (dir) {
160 *dir = "";
161 }
162 if (file_name) {
163 *file_name = file_path;
164 }
165 } else {
166 if (dir) {
167 *dir = file_path.substr(0, pos - 1);
168 }
169 if (file_name) {
170 *file_name = file_path.substr(pos + 1);
171 }
172 }
173
174 return 0;
175}
176
177int RemoveFile(const string &file_path) {
178 int ret{0};

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected