DolphinQt: Turn the compress/decompress action into a dialog

This commit is contained in:
JosJuice 2020-04-04 23:18:15 +02:00
parent 42f6913bcc
commit dae2c14f7f
9 changed files with 283 additions and 195 deletions

View File

@ -18,6 +18,8 @@ add_executable(dolphin-emu
AboutDialog.h AboutDialog.h
CheatsManager.cpp CheatsManager.cpp
CheatsManager.h CheatsManager.h
ConvertDialog.cpp
ConvertDialog.h
DiscordHandler.cpp DiscordHandler.cpp
DiscordHandler.h DiscordHandler.h
DiscordJoinRequestDialog.cpp DiscordJoinRequestDialog.cpp

View File

@ -0,0 +1,217 @@
// Copyright 2020 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include "DolphinQt/ConvertDialog.h"
#include <algorithm>
#include <future>
#include <utility>
#include <QComboBox>
#include <QErrorMessage>
#include <QFileDialog>
#include <QGridLayout>
#include <QLabel>
#include <QList>
#include <QMessageBox>
#include <QPushButton>
#include <QString>
#include <QVBoxLayout>
#include "Common/Assert.h"
#include "DiscIO/Blob.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h"
#include "DolphinQt/QtUtils/ParallelProgressDialog.h"
#include "UICommon/GameFile.h"
static bool CompressCB(const std::string& text, float percent, void* ptr)
{
if (ptr == nullptr)
return false;
auto* progress_dialog = static_cast<ParallelProgressDialog*>(ptr);
progress_dialog->SetValue(percent * 100);
return !progress_dialog->WasCanceled();
}
ConvertDialog::ConvertDialog(QList<std::shared_ptr<const UICommon::GameFile>> files,
QWidget* parent)
: QDialog(parent), m_files(std::move(files))
{
ASSERT(!m_files.empty());
setWindowTitle(tr("Convert"));
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
QGridLayout* grid_layout = new QGridLayout;
grid_layout->setColumnStretch(1, 1);
m_format = new QComboBox;
AddToFormatComboBox(QStringLiteral("ISO"), DiscIO::BlobType::PLAIN);
AddToFormatComboBox(QStringLiteral("GCZ"), DiscIO::BlobType::GCZ);
grid_layout->addWidget(new QLabel(tr("Format:")), 0, 0);
grid_layout->addWidget(m_format, 0, 1);
QPushButton* convert_button = new QPushButton(tr("Convert"));
QVBoxLayout* main_layout = new QVBoxLayout;
main_layout->addLayout(grid_layout);
main_layout->addWidget(convert_button);
setLayout(main_layout);
connect(convert_button, &QPushButton::clicked, this, &ConvertDialog::Convert);
}
void ConvertDialog::AddToFormatComboBox(const QString& name, DiscIO::BlobType format)
{
if (std::all_of(m_files.begin(), m_files.end(),
[format](const auto& file) { return file->GetBlobType() == format; }))
{
return;
}
m_format->addItem(name, static_cast<int>(format));
}
void ConvertDialog::Convert()
{
const DiscIO::BlobType format = static_cast<DiscIO::BlobType>(m_format->currentData().toInt());
const bool scrub_wii = format == DiscIO::BlobType::GCZ;
if (scrub_wii && std::any_of(m_files.begin(), m_files.end(), [](const auto& file) {
return file->GetPlatform() == DiscIO::Platform::WiiDisc;
}))
{
ModalMessageBox wii_warning(this);
wii_warning.setIcon(QMessageBox::Warning);
wii_warning.setWindowTitle(tr("Confirm"));
wii_warning.setText(tr("Are you sure?"));
wii_warning.setInformativeText(
tr("Compressing a Wii disc image will irreversibly change the compressed copy by removing "
"padding data. Your disc image will still work. Continue?"));
wii_warning.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
if (wii_warning.exec() == QMessageBox::No)
return;
}
QString extension;
QString filter;
switch (format)
{
case DiscIO::BlobType::PLAIN:
extension = QStringLiteral(".iso");
filter = tr("Uncompressed GC/Wii images (*.iso *.gcm)");
break;
case DiscIO::BlobType::GCZ:
extension = QStringLiteral(".gcz");
filter = tr("Compressed GC/Wii images (*.gcz)");
break;
default:
ASSERT(false);
return;
}
QString dst_dir;
QString dst_path;
if (m_files.size() > 1)
{
dst_dir = QFileDialog::getExistingDirectory(
this, tr("Select where you want to save the converted images"),
QFileInfo(QString::fromStdString(m_files[0]->GetFilePath())).dir().absolutePath());
if (dst_dir.isEmpty())
return;
}
else
{
dst_path = QFileDialog::getSaveFileName(
this, tr("Select where you want to save the converted image"),
QFileInfo(QString::fromStdString(m_files[0]->GetFilePath()))
.dir()
.absoluteFilePath(
QFileInfo(QString::fromStdString(m_files[0]->GetFilePath())).completeBaseName())
.append(extension),
filter);
if (dst_path.isEmpty())
return;
}
for (const auto& file : m_files)
{
const auto original_path = file->GetFilePath();
if (m_files.size() > 1)
{
dst_path =
QDir(dst_dir)
.absoluteFilePath(QFileInfo(QString::fromStdString(original_path)).completeBaseName())
.append(extension);
QFileInfo dst_info = QFileInfo(dst_path);
if (dst_info.exists())
{
ModalMessageBox confirm_replace(this);
confirm_replace.setIcon(QMessageBox::Warning);
confirm_replace.setWindowTitle(tr("Confirm"));
confirm_replace.setText(tr("The file %1 already exists.\n"
"Do you wish to replace it?")
.arg(dst_info.fileName()));
confirm_replace.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
if (confirm_replace.exec() == QMessageBox::No)
continue;
}
}
ParallelProgressDialog progress_dialog(tr("Converting..."), tr("Abort"), 0, 100, this);
progress_dialog.GetRaw()->setWindowModality(Qt::WindowModal);
progress_dialog.GetRaw()->setWindowTitle(tr("Progress"));
if (m_files.size() > 1)
{
progress_dialog.GetRaw()->setLabelText(
tr("Converting...") + QLatin1Char{'\n'} +
QFileInfo(QString::fromStdString(original_path)).fileName());
}
std::future<bool> good;
if (format == DiscIO::BlobType::PLAIN)
{
good = std::async(std::launch::async, [&] {
const bool good = DiscIO::ConvertToPlain(original_path, dst_path.toStdString(), &CompressCB,
&progress_dialog);
progress_dialog.Reset();
return good;
});
}
else if (format == DiscIO::BlobType::GCZ)
{
good = std::async(std::launch::async, [&] {
const bool good =
DiscIO::ConvertToGCZ(original_path, dst_path.toStdString(),
file->GetPlatform() == DiscIO::Platform::WiiDisc ? 1 : 0, 16384,
&CompressCB, &progress_dialog);
progress_dialog.Reset();
return good;
});
}
progress_dialog.GetRaw()->exec();
if (!good.get())
{
QErrorMessage(this).showMessage(tr("Dolphin failed to complete the requested action."));
return;
}
}
ModalMessageBox::information(this, tr("Success"),
tr("Successfully converted %n image(s).", "", m_files.size()));
close();
}

View File

@ -0,0 +1,37 @@
// Copyright 2020 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include <memory>
#include <QDialog>
#include <QList>
#include "DiscIO/Blob.h"
class QComboBox;
namespace UICommon
{
class GameFile;
}
class ConvertDialog final : public QDialog
{
Q_OBJECT
public:
explicit ConvertDialog(QList<std::shared_ptr<const UICommon::GameFile>> files,
QWidget* parent = nullptr);
private slots:
void Convert();
private:
void AddToFormatComboBox(const QString& name, DiscIO::BlobType format);
QComboBox* m_format;
QList<std::shared_ptr<const UICommon::GameFile>> m_files;
};

View File

@ -131,6 +131,7 @@
<QtMoc Include="Config\PropertiesDialog.h" /> <QtMoc Include="Config\PropertiesDialog.h" />
<QtMoc Include="Config\SettingsWindow.h" /> <QtMoc Include="Config\SettingsWindow.h" />
<QtMoc Include="Config\VerifyWidget.h" /> <QtMoc Include="Config\VerifyWidget.h" />
<QtMoc Include="ConvertDialog.h" />
<QtMoc Include="DiscordHandler.h" /> <QtMoc Include="DiscordHandler.h" />
<QtMoc Include="DiscordJoinRequestDialog.h" /> <QtMoc Include="DiscordJoinRequestDialog.h" />
<QtMoc Include="FIFO\FIFOAnalyzer.h" /> <QtMoc Include="FIFO\FIFOAnalyzer.h" />
@ -211,6 +212,7 @@
<ClCompile Include="$(QtMocOutPrefix)DualShockUDPClientWidget.cpp" /> <ClCompile Include="$(QtMocOutPrefix)DualShockUDPClientWidget.cpp" />
<ClCompile Include="$(QtMocOutPrefix)ControllerInterfaceWindow.cpp" /> <ClCompile Include="$(QtMocOutPrefix)ControllerInterfaceWindow.cpp" />
<ClCompile Include="$(QtMocOutPrefix)ControllersWindow.cpp" /> <ClCompile Include="$(QtMocOutPrefix)ControllersWindow.cpp" />
<ClCompile Include="$(QtMocOutPrefix)ConvertDialog.cpp" />
<ClCompile Include="$(QtMocOutPrefix)DiscordHandler.cpp" /> <ClCompile Include="$(QtMocOutPrefix)DiscordHandler.cpp" />
<ClCompile Include="$(QtMocOutPrefix)DiscordJoinRequestDialog.cpp" /> <ClCompile Include="$(QtMocOutPrefix)DiscordJoinRequestDialog.cpp" />
<ClCompile Include="$(QtMocOutPrefix)DoubleClickEventFilter.cpp" /> <ClCompile Include="$(QtMocOutPrefix)DoubleClickEventFilter.cpp" />
@ -372,6 +374,7 @@
<ClCompile Include="Config\PropertiesDialog.cpp" /> <ClCompile Include="Config\PropertiesDialog.cpp" />
<ClCompile Include="Config\SettingsWindow.cpp" /> <ClCompile Include="Config\SettingsWindow.cpp" />
<ClCompile Include="Config\VerifyWidget.cpp" /> <ClCompile Include="Config\VerifyWidget.cpp" />
<ClCompile Include="ConvertDialog.cpp" />
<ClCompile Include="Debugger\CodeViewWidget.cpp" /> <ClCompile Include="Debugger\CodeViewWidget.cpp" />
<ClCompile Include="Debugger\CodeWidget.cpp" /> <ClCompile Include="Debugger\CodeWidget.cpp" />
<ClCompile Include="Debugger\JITWidget.cpp" /> <ClCompile Include="Debugger\JITWidget.cpp" />

View File

@ -6,7 +6,7 @@
#include <algorithm> #include <algorithm>
#include <cmath> #include <cmath>
#include <future> #include <utility>
#include <QDesktopServices> #include <QDesktopServices>
#include <QDir> #include <QDir>
@ -40,6 +40,7 @@
#include "DiscIO/Enums.h" #include "DiscIO/Enums.h"
#include "DolphinQt/Config/PropertiesDialog.h" #include "DolphinQt/Config/PropertiesDialog.h"
#include "DolphinQt/ConvertDialog.h"
#include "DolphinQt/GameList/GameListModel.h" #include "DolphinQt/GameList/GameListModel.h"
#include "DolphinQt/GameList/GridProxyModel.h" #include "DolphinQt/GameList/GridProxyModel.h"
#include "DolphinQt/GameList/ListProxyModel.h" #include "DolphinQt/GameList/ListProxyModel.h"
@ -53,8 +54,6 @@
#include "UICommon/GameFile.h" #include "UICommon/GameFile.h"
static bool CompressCB(const std::string&, float, void*);
GameList::GameList(QWidget* parent) : QStackedWidget(parent) GameList::GameList(QWidget* parent) : QStackedWidget(parent)
{ {
m_model = Settings::Instance().GetGameListModel(); m_model = Settings::Instance().GetGameListModel();
@ -257,35 +256,16 @@ void GameList::ShowContextMenu(const QPoint&)
if (HasMultipleSelected()) if (HasMultipleSelected())
{ {
bool wii_saves = true; if (std::all_of(GetSelectedGames().begin(), GetSelectedGames().end(), [](const auto& game) {
bool compress = false; return DiscIO::IsDisc(game->GetPlatform()) && game->IsVolumeSizeAccurate();
bool decompress = false; }))
for (const auto& game : GetSelectedGames())
{ {
DiscIO::Platform platform = game->GetPlatform(); menu->addAction(tr("Convert Selected Files..."), this, &GameList::ConvertFile);
menu->addSeparator();
if (platform == DiscIO::Platform::GameCubeDisc || platform == DiscIO::Platform::WiiDisc)
{
const auto blob_type = game->GetBlobType();
if (blob_type == DiscIO::BlobType::GCZ)
decompress = true;
else if (blob_type == DiscIO::BlobType::PLAIN)
compress = true;
}
if (platform != DiscIO::Platform::WiiWAD && platform != DiscIO::Platform::WiiDisc)
wii_saves = false;
} }
if (compress) if (std::all_of(GetSelectedGames().begin(), GetSelectedGames().end(),
menu->addAction(tr("Compress Selected ISOs..."), this, [this] { CompressISO(false); }); [](const auto& game) { return DiscIO::IsWii(game->GetPlatform()); }))
if (decompress)
menu->addAction(tr("Decompress Selected ISOs..."), this, [this] { CompressISO(true); });
if (compress || decompress)
menu->addSeparator();
if (wii_saves)
{ {
menu->addAction(tr("Export Wii Saves"), this, &GameList::ExportWiiSave); menu->addAction(tr("Export Wii Saves"), this, &GameList::ExportWiiSave);
menu->addSeparator(); menu->addSeparator();
@ -306,15 +286,13 @@ void GameList::ShowContextMenu(const QPoint&)
menu->addSeparator(); menu->addSeparator();
} }
if (platform == DiscIO::Platform::GameCubeDisc || platform == DiscIO::Platform::WiiDisc) if (DiscIO::IsDisc(platform))
{ {
menu->addAction(tr("Set as &Default ISO"), this, &GameList::SetDefaultISO); menu->addAction(tr("Set as &Default ISO"), this, &GameList::SetDefaultISO);
const auto blob_type = game->GetBlobType(); const auto blob_type = game->GetBlobType();
if (blob_type == DiscIO::BlobType::GCZ) if (game->IsVolumeSizeAccurate())
menu->addAction(tr("Decompress ISO..."), this, [this] { CompressISO(true); }); menu->addAction(tr("Convert File..."), this, &GameList::ConvertFile);
else if (blob_type == DiscIO::BlobType::PLAIN)
menu->addAction(tr("Compress ISO..."), this, [this] { CompressISO(false); });
QAction* change_disc = menu->addAction(tr("Change &Disc"), this, &GameList::ChangeDisc); QAction* change_disc = menu->addAction(tr("Change &Disc"), this, &GameList::ChangeDisc);
@ -481,157 +459,14 @@ void GameList::OpenWiki()
QDesktopServices::openUrl(QUrl(url)); QDesktopServices::openUrl(QUrl(url));
} }
void GameList::CompressISO(bool decompress) void GameList::ConvertFile()
{ {
auto files = GetSelectedGames(); auto games = GetSelectedGames();
const auto game = GetSelectedGame(); if (games.empty())
if (files.empty() || !game)
return; return;
bool wii_warning_given = false; ConvertDialog dialog{std::move(games), this};
for (QMutableListIterator<std::shared_ptr<const UICommon::GameFile>> it(files); it.hasNext();) dialog.exec();
{
auto file = it.next();
if ((file->GetPlatform() != DiscIO::Platform::GameCubeDisc &&
file->GetPlatform() != DiscIO::Platform::WiiDisc) ||
(decompress && file->GetBlobType() != DiscIO::BlobType::GCZ) ||
(!decompress && file->GetBlobType() != DiscIO::BlobType::PLAIN))
{
it.remove();
continue;
}
if (!wii_warning_given && !decompress && file->GetPlatform() == DiscIO::Platform::WiiDisc)
{
ModalMessageBox wii_warning(this);
wii_warning.setIcon(QMessageBox::Warning);
wii_warning.setWindowTitle(tr("Confirm"));
wii_warning.setText(tr("Are you sure?"));
wii_warning.setInformativeText(tr(
"Compressing a Wii disc image will irreversibly change the compressed copy by removing "
"padding data. Your disc image will still work. Continue?"));
wii_warning.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
if (wii_warning.exec() == QMessageBox::No)
return;
wii_warning_given = true;
}
}
QString dst_dir;
QString dst_path;
if (files.size() > 1)
{
dst_dir = QFileDialog::getExistingDirectory(
this,
decompress ? tr("Select where you want to save the decompressed images") :
tr("Select where you want to save the compressed images"),
QFileInfo(QString::fromStdString(game->GetFilePath())).dir().absolutePath());
if (dst_dir.isEmpty())
return;
}
else
{
dst_path = QFileDialog::getSaveFileName(
this,
decompress ? tr("Select where you want to save the decompressed image") :
tr("Select where you want to save the compressed image"),
QFileInfo(QString::fromStdString(game->GetFilePath()))
.dir()
.absoluteFilePath(
QFileInfo(QString::fromStdString(files[0]->GetFilePath())).completeBaseName())
.append(decompress ? QStringLiteral(".gcm") : QStringLiteral(".gcz")),
decompress ? tr("Uncompressed GC/Wii images (*.iso *.gcm)") :
tr("Compressed GC/Wii images (*.gcz)"));
if (dst_path.isEmpty())
return;
}
for (const auto& file : files)
{
const auto original_path = file->GetFilePath();
if (files.size() > 1)
{
dst_path =
QDir(dst_dir)
.absoluteFilePath(QFileInfo(QString::fromStdString(original_path)).completeBaseName())
.append(decompress ? QStringLiteral(".gcm") : QStringLiteral(".gcz"));
QFileInfo dst_info = QFileInfo(dst_path);
if (dst_info.exists())
{
ModalMessageBox confirm_replace(this);
confirm_replace.setIcon(QMessageBox::Warning);
confirm_replace.setWindowTitle(tr("Confirm"));
confirm_replace.setText(tr("The file %1 already exists.\n"
"Do you wish to replace it?")
.arg(dst_info.fileName()));
confirm_replace.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
if (confirm_replace.exec() == QMessageBox::No)
continue;
}
}
ParallelProgressDialog progress_dialog(
decompress ? tr("Decompressing...") : tr("Compressing..."), tr("Abort"), 0, 100, this);
progress_dialog.GetRaw()->setWindowModality(Qt::WindowModal);
progress_dialog.GetRaw()->setWindowTitle(tr("Progress"));
std::future<bool> good;
if (decompress)
{
if (files.size() > 1)
{
progress_dialog.GetRaw()->setLabelText(
tr("Decompressing...") + QLatin1Char{'\n'} +
QFileInfo(QString::fromStdString(original_path)).fileName());
}
good = std::async(std::launch::async, [&] {
const bool good = DiscIO::ConvertToPlain(original_path, dst_path.toStdString(), &CompressCB,
&progress_dialog);
progress_dialog.Reset();
return good;
});
}
else
{
if (files.size() > 1)
{
progress_dialog.GetRaw()->setLabelText(
tr("Compressing...") + QLatin1Char{'\n'} +
QFileInfo(QString::fromStdString(original_path)).fileName());
}
good = std::async(std::launch::async, [&] {
const bool good =
DiscIO::ConvertToGCZ(original_path, dst_path.toStdString(),
file->GetPlatform() == DiscIO::Platform::WiiDisc ? 1 : 0, 16384,
&CompressCB, &progress_dialog);
progress_dialog.Reset();
return good;
});
}
progress_dialog.GetRaw()->exec();
if (!good.get())
{
QErrorMessage(this).showMessage(tr("Dolphin failed to complete the requested action."));
return;
}
}
ModalMessageBox::information(this, tr("Success"),
decompress ?
tr("Successfully decompressed %n image(s).", "", files.size()) :
tr("Successfully compressed %n image(s).", "", files.size()));
} }
void GameList::InstallWAD() void GameList::InstallWAD()
@ -949,17 +784,6 @@ void GameList::OnGameListVisibilityChanged()
m_grid_proxy->invalidate(); m_grid_proxy->invalidate();
} }
static bool CompressCB(const std::string& text, float percent, void* ptr)
{
if (ptr == nullptr)
return false;
auto* progress_dialog = static_cast<ParallelProgressDialog*>(ptr);
progress_dialog->SetValue(percent * 100);
return !progress_dialog->WasCanceled();
}
void GameList::OnSectionResized(int index, int, int) void GameList::OnSectionResized(int index, int, int)
{ {
auto* hor_header = m_list->horizontalHeader(); auto* hor_header = m_list->horizontalHeader();

View File

@ -64,7 +64,7 @@ private:
void InstallWAD(); void InstallWAD();
void UninstallWAD(); void UninstallWAD();
void ExportWiiSave(); void ExportWiiSave();
void CompressISO(bool decompress); void ConvertFile();
void ChangeDisc(); void ChangeDisc();
void NewTag(); void NewTag();
void DeleteTag(); void DeleteTag();

View File

@ -116,6 +116,7 @@ GameFile::GameFile(std::string path) : m_file_path(std::move(path))
m_blob_type = volume->GetBlobType(); m_blob_type = volume->GetBlobType();
m_file_size = volume->GetRawSize(); m_file_size = volume->GetRawSize();
m_volume_size = volume->GetSize(); m_volume_size = volume->GetSize();
m_volume_size_is_accurate = volume->IsSizeAccurate();
m_internal_name = volume->GetInternalName(); m_internal_name = volume->GetInternalName();
m_game_id = volume->GetGameID(); m_game_id = volume->GetGameID();
@ -136,6 +137,7 @@ GameFile::GameFile(std::string path) : m_file_path(std::move(path))
{ {
m_valid = true; m_valid = true;
m_file_size = m_volume_size = File::GetSize(m_file_path); m_file_size = m_volume_size = File::GetSize(m_file_path);
m_volume_size_is_accurate = true;
m_platform = DiscIO::Platform::ELFOrDOL; m_platform = DiscIO::Platform::ELFOrDOL;
m_blob_type = DiscIO::BlobType::DIRECTORY; m_blob_type = DiscIO::BlobType::DIRECTORY;
} }
@ -296,6 +298,7 @@ void GameFile::DoState(PointerWrap& p)
p.Do(m_file_size); p.Do(m_file_size);
p.Do(m_volume_size); p.Do(m_volume_size);
p.Do(m_volume_size_is_accurate);
p.Do(m_short_names); p.Do(m_short_names);
p.Do(m_long_names); p.Do(m_long_names);

View File

@ -89,6 +89,7 @@ public:
const std::string& GetApploaderDate() const { return m_apploader_date; } const std::string& GetApploaderDate() const { return m_apploader_date; }
u64 GetFileSize() const { return m_file_size; } u64 GetFileSize() const { return m_file_size; }
u64 GetVolumeSize() const { return m_volume_size; } u64 GetVolumeSize() const { return m_volume_size; }
bool IsVolumeSizeAccurate() const { return m_volume_size_is_accurate; }
const GameBanner& GetBannerImage() const; const GameBanner& GetBannerImage() const;
const GameCover& GetCoverImage() const; const GameCover& GetCoverImage() const;
void DoState(PointerWrap& p); void DoState(PointerWrap& p);
@ -124,6 +125,7 @@ private:
u64 m_file_size{}; u64 m_file_size{};
u64 m_volume_size{}; u64 m_volume_size{};
bool m_volume_size_is_accurate{};
std::map<DiscIO::Language, std::string> m_short_names; std::map<DiscIO::Language, std::string> m_short_names;
std::map<DiscIO::Language, std::string> m_long_names; std::map<DiscIO::Language, std::string> m_long_names;

View File

@ -27,7 +27,7 @@
namespace UICommon namespace UICommon
{ {
static constexpr u32 CACHE_REVISION = 16; // Last changed in PR 8313 static constexpr u32 CACHE_REVISION = 17; // Last changed in PR 8738
std::vector<std::string> FindAllGamePaths(const std::vector<std::string>& directories_to_scan, std::vector<std::string> FindAllGamePaths(const std::vector<std::string>& directories_to_scan,
bool recursive_scan) bool recursive_scan)