From bc87c1c409e9d1776b017e11e222f9644db2c927 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Sat, 25 Sep 2010 17:31:06 +0000 Subject: [PATCH] Fix saving to drive root on Windows --- src/bittorrent.cpp | 3 +++ src/torrentadditiondlg.cpp | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/bittorrent.cpp b/src/bittorrent.cpp index d6d848900..bf57c9d79 100644 --- a/src/bittorrent.cpp +++ b/src/bittorrent.cpp @@ -2490,7 +2490,10 @@ void Bittorrent::addConsoleMessage(QString msg, QString) { qDebug("getSavePath, got save_path from persistent data: %s", qPrintable(savePath)); } // Clean path + savePath = savePath.replace("\\", "/"); savePath = misc::expandPath(savePath); + if(!savePath.endsWith("/")) + savePath += "/"; return savePath; } diff --git a/src/torrentadditiondlg.cpp b/src/torrentadditiondlg.cpp index c707d7b07..9b744e685 100644 --- a/src/torrentadditiondlg.cpp +++ b/src/torrentadditiondlg.cpp @@ -513,6 +513,7 @@ void torrentAdditionDialog::renameSelectedFile() { save_path = save_path.replace("\\", "/"); #endif save_path = misc::expandPath(save_path); + qDebug("Save path is %s", qPrintable(save_path)); if(!is_magnet && t->num_files() == 1) { // Remove file name QStringList parts = save_path.split("/"); @@ -521,6 +522,7 @@ void torrentAdditionDialog::renameSelectedFile() { files_path << single_file_name; save_path = parts.join("/"); } + qDebug("Save path dir is %s", qPrintable(save_path)); QDir savePath(save_path); const QString current_label = comboLabel->currentText().trimmed(); if (!current_label.isEmpty() && !misc::isValidFileSystemName(current_label)) { @@ -528,7 +530,8 @@ void torrentAdditionDialog::renameSelectedFile() { return; } // Save savepath - TorrentTempData::setSavePath(hash, savePath.path()); + qDebug("Saving save path to temp data: %s", qPrintable(savePath.absolutePath())); + TorrentTempData::setSavePath(hash, savePath.absolutePath()); qDebug("Torrent label is: %s", qPrintable(comboLabel->currentText().trimmed())); if(!current_label.isEmpty()) TorrentTempData::setLabel(hash, current_label);