- Handle paths with (~, ., ..) properly

This commit is contained in:
Christophe Dumez 2009-12-22 10:29:39 +00:00
parent c334439df6
commit 50e620daf2
5 changed files with 67 additions and 33 deletions

View file

@ -1836,11 +1836,13 @@ QString Bittorrent::getSavePath(QString hash) {
}
qDebug("getSavePath, got save_path from persistent data: %s", savePath.toLocal8Bit().data());
}
// Clean path
savePath = misc::expandPath(savePath);
// Checking if savePath Dir exists
// create it if it is not
QDir saveDir(savePath);
if(!saveDir.exists()) {
if(!saveDir.mkpath(saveDir.path())) {
if(!saveDir.mkpath(saveDir.absolutePath())) {
std::cerr << "Couldn't create the save directory: " << saveDir.path().toLocal8Bit().data() << "\n";
// XXX: Do something else?
}