Skip to content

Commit

Permalink
core: make new document method more verbose ; tools_qt: fix typo in v…
Browse files Browse the repository at this point in the history
…ariable name
  • Loading branch information
wisk committed Mar 6, 2017
1 parent 11eace2 commit 1279439
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
20 changes: 16 additions & 4 deletions src/core/medusa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,14 +172,14 @@ bool Medusa::NewDocument(
auto const& AllLdrs = rModMgr.GetLoaders();
if (AllLdrs.empty())
{
Log::Write("core") << "there is not supported loader" << LogEnd;
Log::Write("core").Level(LogError) << "there is not supported loader" << LogEnd;
return false;
}

auto const& AllArchs = rModMgr.GetArchitectures();
if (AllArchs.empty())
{
Log::Write("core") << "there is not supported architecture" << LogEnd;
Log::Write("core").Level(LogError) << "there is not supported architecture" << LogEnd;
return false;
}

Expand All @@ -189,29 +189,41 @@ bool Medusa::NewDocument(
OperatingSystem::SPType spCurOs;

if (!ModuleSelector(spBinStrm, spCurDb, spCurLdr, spCurArchs, spCurOs))
{
Log::Write("core").Level(LogError) << "failed to select modules" << LogEnd;
return false;
}

if (spCurDb == nullptr)
{
Log::Write("core") << "there's no available database" << LogEnd;
Log::Write("core").Level(LogError) << "there's no available database" << LogEnd;
return false;
}

if (spCurLdr == nullptr)
{
Log::Write("core") << "there's no available loader" << LogEnd;
Log::Write("core").Level(LogError) << "there's no available loader" << LogEnd;
return false;
}

bool Force = true;
Path DbPath;
std::list<Filter> ExtList;
if (!AskDatabase(DbPath, ExtList))
{
Log::Write("core").Level(LogError) << "failed to ask for database path" << LogEnd;
return false;
}
if (DbPath.empty())
{
Log::Write("core").Level(LogError) << "path to database is empty" << LogEnd;
return false;
}
if (!spCurDb->Create(DbPath, Force))
{
Log::Write("core").Level(LogError) << "failed to create database to: " << DbPath.string().c_str() << LogEnd;
return false;
}

if (!BeforeStart())
return false;
Expand Down
2 changes: 1 addition & 1 deletion src/tools/qt/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ bool MainWindow::openDocument()
return _medusa.NewDocument(std::make_shared<medusa::FileBinaryStream>(_fileName.toStdWString()), true,
[&](medusa::Path& rDbPath, std::list<medusa::Medusa::Filter> const& filters)
{
auto DbPrDbPathath = QFileDialog::getSaveFileName(this,
rDbPath = QFileDialog::getSaveFileName(this,
"Select a database path",
QString::fromStdString(rDbPath.string())
).toStdString();
Expand Down

0 comments on commit 1279439

Please sign in to comment.