mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-03 22:22:33 -06:00
- Handle paths with (~, ., ..) properly
This commit is contained in:
@@ -205,7 +205,7 @@ public:
|
||||
public slots:
|
||||
|
||||
void updateDiskSpaceLabels() {
|
||||
long long available = misc::freeDiskSpaceOnPath(savePathTxt->text());
|
||||
long long available = misc::freeDiskSpaceOnPath(misc::expandPath(savePathTxt->text()));
|
||||
lbl_disk_space->setText(misc::friendlyUnit(available));
|
||||
|
||||
// Determine torrent size
|
||||
@@ -235,9 +235,10 @@ public slots:
|
||||
|
||||
void on_browseButton_clicked(){
|
||||
QString dir;
|
||||
QDir saveDir(savePathTxt->text());
|
||||
if(saveDir.exists()){
|
||||
dir = QFileDialog::getExistingDirectory(this, tr("Choose save path"), savePathTxt->text());
|
||||
QString save_path = misc::expandPath(savePathTxt->text());
|
||||
QDir saveDir(save_path);
|
||||
if(!save_path.isEmpty() && saveDir.exists()){
|
||||
dir = QFileDialog::getExistingDirectory(this, tr("Choose save path"), saveDir.absolutePath());
|
||||
}else{
|
||||
dir = QFileDialog::getExistingDirectory(this, tr("Choose save path"), QDir::homePath());
|
||||
}
|
||||
@@ -261,11 +262,11 @@ public slots:
|
||||
}
|
||||
|
||||
void on_OkButton_clicked(){
|
||||
QDir savePath(savePathTxt->text());
|
||||
if(savePathTxt->text().trimmed().isEmpty()){
|
||||
QMessageBox::critical(0, tr("Empty save path"), tr("Please enter a save path"));
|
||||
return;
|
||||
}
|
||||
QDir savePath(misc::expandPath(savePathTxt->text()));
|
||||
// Check if savePath exists
|
||||
if(!savePath.exists()){
|
||||
if(!savePath.mkpath(savePath.path())){
|
||||
|
||||
Reference in New Issue
Block a user