MCPcopy Create free account
hub / github.com/acl-dev/acl / parse_filePath

Method parse_filePath

lib_acl_cpp/src/queue/queue_manager.cpp:169–211  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

167}
168
169bool queue_manager::parse_filePath(const char* filePath, string* home,
170 string* queueName, string* queueSub,
171 string* partName, string* extName)
172{
173 if (filePath == NULL || *filePath == 0) {
174 logger_error("filePath invalid!");
175 return false;
176 }
177
178 // ��ʽΪ: /home/queue_name/queue_sub_node/file_name.file_ext
179
180 ACL_ARGV *argv = acl_argv_split(filePath, "/\\");
181 if (argv->argc < 4) {
182 logger_error("filePath(%s) invalid", filePath);
183 acl_argv_free(argv);
184 return false;
185 }
186
187 home->clear();
188
189 // �����һ���ַ�Ϊ PATH_SEP ����Ҫ����
190 if (*filePath == PATH_SEP) {
191 home->push_back(PATH_SEP);
192 }
193
194 // ���洢��·������
195 for (int i = 0; i < argv->argc - 3; i++) {
196 if (i > 0 && home->length() > 0) {
197 (*home) += PATH_SEP;
198 }
199 (*home) += argv->argv[i];
200 }
201
202 // ȡ�ö�����
203 *queueName = argv->argv[argv->argc - 3];
204 *queueSub = argv->argv[argv->argc - 2];
205
206 // ���������������
207 bool ret = parse_fileName(argv->argv[argv->argc - 1], partName, extName);
208
209 acl_argv_free(argv);
210 return ret;
211}
212
213bool queue_manager::parse_fileName(const char* fileName, string* partName, string* extName)
214{

Callers

nothing calls this directly

Calls 5

acl_argv_splitFunction · 0.85
acl_argv_freeFunction · 0.85
clearMethod · 0.45
push_backMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected