mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Implemented issue #4
This commit is contained in:
@@ -201,7 +201,11 @@ namespace boss {
|
||||
}
|
||||
|
||||
Plugin::Plugin() : enabled(true), priority(0), isMaster(false) {}
|
||||
Plugin::Plugin(const std::string& n) : name(n), enabled(true), priority(0), isMaster(false) {}
|
||||
Plugin::Plugin(const std::string& n) : name(n), enabled(true), priority(0), isMaster(false) {
|
||||
//If the name passed ends in '.ghost', that should be trimmed.
|
||||
if (boost::iends_with(name, ".ghost"))
|
||||
name = name.substr(0, name.length() - 6);
|
||||
}
|
||||
|
||||
Plugin::Plugin(boss::Game& game, const std::string& n, const bool headerOnly)
|
||||
: name(n), enabled(true), priority(0) {
|
||||
@@ -218,6 +222,10 @@ namespace boss {
|
||||
plugins.push_back(name);
|
||||
for (vector<uint32_t>::const_iterator it = records.begin(),endIt = records.end(); it != endIt; ++it)
|
||||
formIDs.insert(FormID(plugins, *it));
|
||||
|
||||
//If the name passed ends in '.ghost', that should be trimmed.
|
||||
if (boost::iends_with(name, ".ghost"))
|
||||
name = name.substr(0, name.length() - 6);
|
||||
|
||||
//Also read Bash Tags applied and version string in description.
|
||||
for(size_t i=0,max=file.fields.size(); i < max; ++i){
|
||||
@@ -554,4 +562,12 @@ namespace boss {
|
||||
|
||||
return boost::ilexicographical_compare(lhs.Name(), rhs.Name());
|
||||
}
|
||||
|
||||
bool IsPlugin(const std::string& file) {
|
||||
if (boost::iends_with(file, ".esp") || boost::iends_with(file, ".esm")
|
||||
|| boost::iends_with(file, ".esp.ghost") || boost::iends_with(file, ".esm.ghost"))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -186,7 +186,7 @@ namespace boss {
|
||||
|
||||
bool load_order_sort(const Plugin& lhs, const Plugin& rhs);
|
||||
|
||||
|
||||
bool IsPlugin(const std::string& file);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -498,10 +498,6 @@ namespace boss {
|
||||
result = game->IsActive(file);
|
||||
}
|
||||
|
||||
bool IsPlugin(const std::string& file) {
|
||||
return boost::iends_with(file, ".esm") || boost::iends_with(file, ".esp");
|
||||
}
|
||||
|
||||
void SyntaxError(Iterator const& /*first*/, Iterator const& last, Iterator const& errorpos, boost::spirit::info const& what) {
|
||||
|
||||
std::string context(errorpos, min(errorpos +50, last));
|
||||
|
||||
+2
-2
@@ -326,7 +326,7 @@ void Launcher::OnSortPlugins(wxCommandEvent& event) {
|
||||
// Get a list of the plugins.
|
||||
list<boss::Plugin> plugins;
|
||||
for (fs::directory_iterator it(_game.DataPath()); it != fs::directory_iterator(); ++it) {
|
||||
if (fs::is_regular_file(it->status()) && (it->path().extension().string() == ".esp" || it->path().extension().string() == ".esm")) {
|
||||
if (fs::is_regular_file(it->status()) && IsPlugin(it->path().string())) {
|
||||
|
||||
string filename = it->path().filename().string();
|
||||
out << "Reading plugin: " << filename << endl;
|
||||
@@ -577,7 +577,7 @@ void Launcher::OnEditMetadata(wxCommandEvent& event) {
|
||||
|
||||
//Scan for installed plugins.
|
||||
for (fs::directory_iterator it(_game.DataPath()); it != fs::directory_iterator(); ++it) {
|
||||
if (fs::is_regular_file(it->status()) && (it->path().extension().string() == ".esp" || it->path().extension().string() == ".esm")) {
|
||||
if (fs::is_regular_file(it->status()) && IsPlugin(it->path().string())) {
|
||||
boss::Plugin plugin(_game, it->path().filename().string(), true);
|
||||
installed.push_back(plugin);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user