From 77e668a1b6a1bf38d10ed9b09423161d7b2cce4a Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Fri, 19 Jun 2015 00:19:31 +0200 Subject: [PATCH] Correctly handle path tokens in download destinations --- apps/Launcher/infowidget.cpp | 16 ---------------- apps/Launcher/mainwindow.cpp | 4 +++- apps/Launcher/syncwidget.cpp | 14 +++++++++++--- 3 files changed, 14 insertions(+), 20 deletions(-) diff --git a/apps/Launcher/infowidget.cpp b/apps/Launcher/infowidget.cpp index 95a0e02700..04f8ca49f6 100644 --- a/apps/Launcher/infowidget.cpp +++ b/apps/Launcher/infowidget.cpp @@ -60,22 +60,6 @@ InfoWidget::InfoWidget(QString name, int totalBytes) setLayout(layout); } -//void InfoWidget::update(int currentBytes) { -// _bytes->setText( -// QString("%1 / %2") -// .arg(currentBytes) -// .arg(_totalBytes) -// ); -// -// float progress = static_cast(currentBytes) / static_cast(_totalBytes); -// _progress->setValue(static_cast(progress * 100)); -//} -// -//void InfoWidget::update(float progress) { -// _bytes->setText(""); -// _progress->setValue(static_cast(progress * 100)); -//} - void InfoWidget::update(openspace::DownloadManager::FileFuture* f) { _bytes->setText( QString("%1 / %2") diff --git a/apps/Launcher/mainwindow.cpp b/apps/Launcher/mainwindow.cpp index ff3a0539f5..115b823dd1 100644 --- a/apps/Launcher/mainwindow.cpp +++ b/apps/Launcher/mainwindow.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include #include @@ -171,8 +172,9 @@ void MainWindow::initialize() { _syncWidget->setWindowModality(Qt::WindowModal); _syncWidget->hide(); - ghoul::logging::LogManager::initialize(ghoul::logging::LogManager::LogLevel::Error); + ghoul::logging::LogManager::initialize(ghoul::logging::LogManager::LogLevel::Debug); LogMgr.addLog(new ghoul::logging::ConsoleLog); + LogMgr.addLog(new ghoul::logging::HTMLLog("LauncherLog.html")); LogMgr.addLog(new QLog); std::string configurationFile = _configurationFile; diff --git a/apps/Launcher/syncwidget.cpp b/apps/Launcher/syncwidget.cpp index 9f23e35368..047ac456de 100644 --- a/apps/Launcher/syncwidget.cpp +++ b/apps/Launcher/syncwidget.cpp @@ -68,8 +68,8 @@ namespace { const std::string IdentifierKey = "Identifier"; const std::string VersionKey = "Version"; - const bool OverwriteFiles = true; - const bool CleanInfoWidgets = false; + const bool OverwriteFiles = false; + const bool CleanInfoWidgets = true; } SyncWidget::SyncWidget(QWidget* parent, Qt::WindowFlags f) @@ -202,8 +202,13 @@ void SyncWidget::handleFileRequest() { for (const FileRequest& f : _fileRequests) { LDEBUG(f.identifier.toStdString() << " (" << f.version << ") -> " << f.destination.toStdString()); + ghoul::filesystem::Directory d = FileSys.currentDirectory(); + std::string thisDirectory = absPath("${SCENE}/" + f.module.toStdString() + "/"); + FileSys.setCurrentDirectory(thisDirectory); + + std::string identifier = f.identifier.toStdString(); - std::string path = absPath("${SCENE}/" + f.module.toStdString() + "/" + f.destination.toStdString()); + std::string path = absPath(f.destination.toStdString()); int version = f.version; DlManager.downloadRequestFilesAsync( @@ -213,6 +218,8 @@ void SyncWidget::handleFileRequest() { OverwriteFiles, std::bind(&SyncWidget::handleFileFutureAddition, this, std::placeholders::_1) ); + + FileSys.setCurrentDirectory(d); } } @@ -282,6 +289,7 @@ void SyncWidget::syncButtonPressed() { std::string module = modules.value(std::to_string(i)); modulesList.append(QString::fromStdString(module)); } + modulesList.append("common"); QDir sceneDir(scene); sceneDir.cdUp();