| 531 | ////////////////////////////////////////////////////////////////////////// |
| 532 | |
| 533 | std::string createRelativePath(const std::string& _path, const std::string& _relativeTo, const bool _allowHome) |
| 534 | { |
| 535 | bool contains = false; |
| 536 | std::string path = removeCommonPath(_path, _relativeTo, contains); |
| 537 | |
| 538 | // success |
| 539 | if(contains) |
| 540 | return ("./" + path); |
| 541 | |
| 542 | if(_allowHome) |
| 543 | { |
| 544 | path = removeCommonPath(_path, getHomePath(), contains); |
| 545 | |
| 546 | // success |
| 547 | if(contains) |
| 548 | return ("~/" + path); |
| 549 | } |
| 550 | |
| 551 | // nothing to resolve |
| 552 | return path; |
| 553 | |
| 554 | } // createRelativePath |
| 555 | |
| 556 | ////////////////////////////////////////////////////////////////////////// |
| 557 |
no test coverage detected