mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-25 18:56:34 +03:00
Fix file renaming.
This commit is contained in:
parent
c673b1a7d7
commit
273725d9dc
2 changed files with 4 additions and 4 deletions
|
@ -403,7 +403,7 @@ void AddNewTorrentDialog::renameSelectedFile()
|
||||||
qDebug("Name did not change");
|
qDebug("Name did not change");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
new_name = fsutils::expandPathAbs(new_name);
|
new_name = fsutils::expandPath(new_name);
|
||||||
qDebug("New name: %s", qPrintable(new_name));
|
qDebug("New name: %s", qPrintable(new_name));
|
||||||
// Check if that name is already used
|
// Check if that name is already used
|
||||||
for (int i=0; i<m_torrentInfo->num_files(); ++i) {
|
for (int i=0; i<m_torrentInfo->num_files(); ++i) {
|
||||||
|
@ -456,7 +456,7 @@ void AddNewTorrentDialog::renameSelectedFile()
|
||||||
if (current_name.startsWith(old_path)) {
|
if (current_name.startsWith(old_path)) {
|
||||||
QString new_name = current_name;
|
QString new_name = current_name;
|
||||||
new_name.replace(0, old_path.length(), new_path);
|
new_name.replace(0, old_path.length(), new_path);
|
||||||
new_name = fsutils::expandPathAbs(new_name);
|
new_name = fsutils::expandPath(new_name);
|
||||||
qDebug("Rename %s to %s", qPrintable(current_name), qPrintable(new_name));
|
qDebug("Rename %s to %s", qPrintable(current_name), qPrintable(new_name));
|
||||||
// Rename in files_path
|
// Rename in files_path
|
||||||
m_filesPath.replace(i, new_name);
|
m_filesPath.replace(i, new_name);
|
||||||
|
|
|
@ -564,7 +564,7 @@ void PropertiesWidget::renameSelectedFile() {
|
||||||
qDebug("Name did not change");
|
qDebug("Name did not change");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
new_name = fsutils::expandPathAbs(new_name);
|
new_name = fsutils::expandPath(new_name);
|
||||||
// Check if that name is already used
|
// Check if that name is already used
|
||||||
for (int i=0; i<h.num_files(); ++i) {
|
for (int i=0; i<h.num_files(); ++i) {
|
||||||
if (i == file_index) continue;
|
if (i == file_index) continue;
|
||||||
|
@ -627,7 +627,7 @@ void PropertiesWidget::renameSelectedFile() {
|
||||||
new_name.replace(0, old_path.length(), new_path);
|
new_name.replace(0, old_path.length(), new_path);
|
||||||
if (!force_recheck && QDir(h.save_path()).exists(new_name))
|
if (!force_recheck && QDir(h.save_path()).exists(new_name))
|
||||||
force_recheck = true;
|
force_recheck = true;
|
||||||
new_name = fsutils::expandPathAbs(new_name);
|
new_name = fsutils::expandPath(new_name);
|
||||||
qDebug("Rename %s to %s", qPrintable(current_name), qPrintable(new_name));
|
qDebug("Rename %s to %s", qPrintable(current_name), qPrintable(new_name));
|
||||||
h.rename_file(i, new_name);
|
h.rename_file(i, new_name);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue