some PIFile functionality

PIBinaryLog::close fix
This commit is contained in:
2022-12-26 14:09:05 +03:00
parent 81cbf905ba
commit f355cfc05e
6 changed files with 27 additions and 1 deletions

View File

@@ -160,6 +160,16 @@ PIDir & PIDir::cleanPath() {
PIString PIDir::relative(const PIString & path) const {
PIDir td(path);
PIStringList dl(absolutePath().split(separator)), pl(td.absolutePath().split(separator)), rl;
auto checkPath = [](PIStringList & path) {
if (path.isEmpty()) return;
if (path[0].size() >= 2) {
if (path[0][0].isAlpha() && path[0][1] == ':') {
path[0][0] = path[0][0].toUpper();
}
}
};
checkPath(dl);
checkPath(pl);
// piCout << pl << "rel to" << dl;
while (!dl.isEmpty() && !pl.isEmpty()) {
if (dl.front() != pl.front()) break;