diff --git a/CMakeLists.txt b/CMakeLists.txt index 2b0388f66..7e8ad3318 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,7 +25,7 @@ set(DF_VERSION_MINOR "31") set(DF_VERSION_PATCH "25") set(DF_VERSION "${DF_VERSION_MAJOR}.${DF_VERSION_MINOR}.${DF_VERSION_PATCH}") -set(DFHACK_RELEASE "1") +set(DFHACK_RELEASE "3") ## where to install things (after the build is done, classic 'make install' or package structure) # the dfhack libraries will be installed here: diff --git a/library/Core.cpp b/library/Core.cpp index 0ef386a96..6ca57703b 100644 --- a/library/Core.cpp +++ b/library/Core.cpp @@ -407,13 +407,25 @@ bool Core::Init() vif = new DFHack::VersionInfoFactory(path); p = new DFHack::Process(vif); vinfo = p->getDescriptor(); - // dump offsets to a file - std::ofstream dump("offsets.log"); - if(!dump.fail()) + + if(!vinfo) { - dump << vinfo->PrintOffsets(); - dump.close(); + cerr << "Couldn't retrieve version information.\n"; + errorstate = true; + delete p; + p = NULL; + return false; } + + if (!p->isIdentified()) + { + cerr << "Couldn't identify this version of DF.\n"; + errorstate = true; + delete p; + p = NULL; + return false; + } + // init the console. Gui * g = getGui(); if(g->init) @@ -426,13 +438,12 @@ bool Core::Init() } else con.init(false); - if (!p->isIdentified()) + // dump offsets to a file + std::ofstream dump("offsets.log"); + if(!dump.fail()) { - con.printerr("Couldn't identify this version of DF.\n"); - errorstate = true; - delete p; - p = NULL; - return false; + dump << vinfo->PrintOffsets(); + dump.close(); } // create mutex for syncing with interactive tasks diff --git a/library/Process-linux.cpp b/library/Process-linux.cpp index f68fd20b7..718d0f804 100644 --- a/library/Process-linux.cpp +++ b/library/Process-linux.cpp @@ -58,6 +58,7 @@ Process::Process(VersionInfoFactory * known_versions) target_result = readlink(exe_link_name, target_name, sizeof(target_name)-1); if (target_result == -1) { + cerr << "Failed to readlink(/proc/self/exe)\n"; return; } // make sure we have a null terminated string... @@ -77,6 +78,14 @@ Process::Process(VersionInfoFactory * known_versions) my_descriptor->setParentProcess(this); identified = true; } + else + { + cerr << "Unable to retrieve version information.\n"; + } + } + else + { + cerr << "This isn't DF.\n"; } } diff --git a/library/VersionInfoFactory.cpp b/library/VersionInfoFactory.cpp index 15f3f8a6a..2c9bb3201 100644 --- a/library/VersionInfoFactory.cpp +++ b/library/VersionInfoFactory.cpp @@ -28,6 +28,7 @@ distribution. #include #include #include +#include using namespace std; #include "dfhack/VersionInfoFactory.h" @@ -680,12 +681,18 @@ void VersionInfoFactory::ParseVersion (TiXmlElement* entry, VersionInfo* mem) bool VersionInfoFactory::loadFile(string path_to_xml) { TiXmlDocument doc( path_to_xml.c_str() ); + std::cerr << "Loading " << path_to_xml << " ... "; //bool loadOkay = doc.LoadFile(); if (!doc.LoadFile()) { error = true; + cerr << "failed!\n"; throw Error::MemoryXmlParse(doc.ErrorDesc(), doc.ErrorId(), doc.ErrorRow(), doc.ErrorCol()); } + else + { + cerr << "OK\n"; + } TiXmlHandle hDoc(&doc); TiXmlElement* pElem; TiXmlHandle hRoot(0);