MCPcopy Create free account
hub / github.com/3rdparty/libprocess / absolutePath

Method absolutePath

src/process.cpp:3297–3325  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3295
3296
3297string ProcessManager::absolutePath(const string& path)
3298{
3299 // Return directly when delegate is empty.
3300 if (delegate.isNone()) {
3301 return path;
3302 }
3303
3304 vector<string> tokens = strings::tokenize(path, "/");
3305
3306 // Return delegate when path is root.
3307 if (tokens.size() == 0) {
3308 return "/" + delegate.get();
3309 }
3310
3311 Try<string> decode = http::decode(tokens[0]);
3312
3313 // Return path when decode failed
3314 if (decode.isError()) {
3315 VLOG(1) << "Failed to decode URL path: " << decode.error();
3316 return path;
3317 }
3318
3319 if (processes.find(decode.get()) != processes.end()) {
3320 // Return path when the first token is a process id.
3321 return path;
3322 } else {
3323 return "/" + delegate.get() + path;
3324 }
3325}
3326
3327
3328void ProcessManager::enqueue(ProcessBase* process)

Callers 1

absolutePathFunction · 0.80

Calls 3

decodeFunction · 0.70
sizeMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected