From d55741015606013cc1c68a0656b987dacba7c72a Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Sat, 25 Sep 2010 16:01:07 +0000 Subject: [PATCH] Fix save path encoding problem on Windows --- src/bittorrent.cpp | 8 ++++---- src/qtorrenthandle.cpp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/bittorrent.cpp b/src/bittorrent.cpp index a62d560bc..d6d848900 100644 --- a/src/bittorrent.cpp +++ b/src/bittorrent.cpp @@ -867,13 +867,13 @@ QTorrentHandle Bittorrent::addMagnetUri(QString magnet_uri, bool resumed) { qDebug("addMagnetURI: Temp folder is enabled."); qDebug("addTorrent::Temp folder is enabled."); QString torrent_tmp_path = defaultTempPath.replace("\\", "/"); - p.save_path = torrent_tmp_path.toLocal8Bit().constData(); + p.save_path = torrent_tmp_path.toUtf8().constData(); // Check if save path exists, creating it otherwise if(!QDir(torrent_tmp_path).exists()) QDir().mkpath(torrent_tmp_path); qDebug("addMagnetURI: using save_path: %s", qPrintable(torrent_tmp_path)); } else { - p.save_path = savePath.toLocal8Bit().constData(); + p.save_path = savePath.toUtf8().constData(); // Check if save path exists, creating it otherwise if(!QDir(savePath).exists()) QDir().mkpath(savePath); @@ -1121,13 +1121,13 @@ QTorrentHandle Bittorrent::addTorrent(QString path, bool fromScanDir, QString fr if(!torrent_tmp_path.endsWith("/")) torrent_tmp_path += "/"; torrent_tmp_path += root_folder; } - p.save_path = torrent_tmp_path.toLocal8Bit().constData(); + p.save_path = torrent_tmp_path.toUtf8().constData(); // Check if save path exists, creating it otherwise if(!QDir(torrent_tmp_path).exists()) QDir().mkpath(torrent_tmp_path); qDebug("addTorrent: using save_path: %s", qPrintable(torrent_tmp_path)); } else { - p.save_path = savePath.toLocal8Bit().constData(); + p.save_path = savePath.toUtf8().constData(); // Check if save path exists, creating it otherwise if(!QDir(savePath).exists()) QDir().mkpath(savePath); diff --git a/src/qtorrenthandle.cpp b/src/qtorrenthandle.cpp index 682131206..1c149d5ed 100644 --- a/src/qtorrenthandle.cpp +++ b/src/qtorrenthandle.cpp @@ -227,7 +227,7 @@ int QTorrentHandle::num_incomplete() const { QString QTorrentHandle::save_path() const { Q_ASSERT(h.is_valid()); - return misc::toQString(h.save_path().string()).replace("\\", "/"); + return misc::toQStringU(h.save_path().string()).replace("\\", "/"); } #if LIBTORRENT_VERSION_MINOR > 14