git-svn-id: svn://db.shs.com.ru/pip@463 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5

This commit is contained in:
2017-04-21 15:04:37 +00:00
parent bf02406736
commit 929c0869cc
2 changed files with 24 additions and 26 deletions

View File

@@ -186,26 +186,39 @@ PIDir & PIDir::cd(const PIString & path) {
bool PIDir::make(bool withParents) {
PIDir d = cleanedPath();
PIString tp;
bool is_abs = isAbsolute();
//bool is_abs = isAbsolute();
if (withParents) {
PIStringList l = d.path().split(separator);
for (int i = l.size_s() - 1; i >= 0; --i) {
//piCout << l;
l.removeAll("");
//piCout << l;
PIString cdp;
piForeachC (PIString & i, l) {
if (!cdp.isEmpty())
cdp += separator;
cdp += i;
//piCout << cdp;
if (!isExists(cdp))
if (!makeDir(cdp))
return false;
}
/*for (int i = l.size_s() - 1; i >= 0; --i) {
if (i > 1) tp = PIStringList(l).remove(i, l.size_s() - i).join(separator);
else {
tp = separator;
if (!is_abs) tp.push_front('.');
}
//piCout << tp;
piCout << "check" << tp;
if (isExists(tp)) {
for (int j = i + 1; j <= l.size_s(); ++j) {
tp = PIStringList(l).remove(j, l.size_s() - j).join(separator);
//piCout << tp;
piCout << "make" << tp;
if (makeDir(tp)) continue;
else return false;
}
break;
};
}
}*/
return true;
} else
if (makeDir(d.path())) return true;