redirect the user to configuration if the download path is not given

Sat, 24 Aug 2013 16:17:48 +0300

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Sat, 24 Aug 2013 16:17:48 +0300
changeset 482
5e96648f416f
parent 481
1db661456fb4
child 483
138b7c5c3c59

redirect the user to configuration if the download path is not given

src/configDialog.cpp file | annotate | diff | comparison | revisions
src/download.cpp file | annotate | diff | comparison | revisions
--- a/src/configDialog.cpp	Sat Aug 24 15:01:31 2013 +0300
+++ b/src/configDialog.cpp	Sat Aug 24 16:17:48 2013 +0300
@@ -292,10 +292,6 @@
 	ld_defaultname = ui->m_profileName->text();
 	ld_defaultlicense = ui->m_profileLicense->currentIndex();
 	
-	// Ensure '/' postfix to the download path
-	if (net_downloadpath.value.right (1) != DIRSLASH)
-		net_downloadpath += DIRSLASH;
-	
 	// Rebuild the quick color toolbar
 	g_win->setQuickColors (quickColors);
 	gui_colortoolbar = quickColorString();
--- a/src/download.cpp	Sat Aug 24 15:01:31 2013 +0300
+++ b/src/download.cpp	Sat Aug 24 16:17:48 2013 +0300
@@ -28,6 +28,7 @@
 #include "gui.h"
 #include "file.h"
 #include "gldraw.h"
+#include "configDialog.h"
 
 cfg (String, net_downloadpath, "");
 cfg (Bool, net_guesspaths, true);
@@ -43,6 +44,8 @@
 	if (path == "" || QDir (path).exists() == false) {
 		critical (PartDownloader::tr ("You need to specify a valid path for "
 			"downloaded files in the configuration to download paths."));
+		
+		(new ConfigDialog (ConfigDialog::DownloadTab, null))->exec();
 		return;
 	}
 	
@@ -196,7 +199,7 @@
 		
 		modifyDest (dest);
 		
-		if (QFile::exists (PartDownloader::getDownloadPath() + dest)) {
+		if (QFile::exists (PartDownloader::getDownloadPath() + DIRSLASH + dest)) {
 			const str overwritemsg = fmt (tr ("%1 already exists in download directory. Overwrite?"), dest);
 			
 			if (!confirm (tr ("Overwrite?"), overwritemsg))
@@ -224,7 +227,7 @@
 		return;
 	
 	modifyDest (dest);
-	print ("DOWNLOAD: %1 -> %2\n", url, PartDownloader::getDownloadPath() + dest);
+	print ("DOWNLOAD: %1 -> %2\n", url, PartDownloader::getDownloadPath() + DIRSLASH + dest);
 	PartDownloadRequest* req = new PartDownloadRequest (url, dest, primary, this);
 	
 	m_filesToDownload << dest;
@@ -298,7 +301,7 @@
 	m_prompt (parent),
 	m_url (url),
 	m_dest (dest),
-	m_fpath (PartDownloader::getDownloadPath() + dest),
+	m_fpath (PartDownloader::getDownloadPath() + DIRSLASH + dest),
 	m_nam (new QNetworkAccessManager),
 	m_firstUpdate (true),
 	m_state (Requesting),

mercurial