summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorTannin <devnull@localhost>2013-03-13 19:35:20 +0100
committerTannin <devnull@localhost>2013-03-13 19:35:20 +0100
commitb3d0fcb2083143dc21c751adafd2523c3555e5d2 (patch)
tree6adeeedc26848af1d5dd96be17b4bca97ede085d /src/shared
parent93e073c32445eefba5595123b28acf87d9f409e8 (diff)
- some more safety checks in the ini-limit removal code
- some code cleanup and minor bug fixes based on results from static code analysis - added naemfilter for the esp list - bsa changes are now stored automatically but delayed by up to 0.5 seconds (for performance reasons) - bugfix: buffer overrun when certain functions are called with empty file names - bugfix: reroute for the ini-limit fix was placed in the data segment - bugfix: mod list got mixed up when the mod directory was changed externally - bugfix: plugins.txt reroute on skyrim didn't work on winXP - bugfix: MO could become unresponsive if the tutorial script couldn't be interpreted
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/skyriminfo.cpp12
-rw-r--r--src/shared/skyriminfo.h4
-rw-r--r--src/shared/util.cpp7
-rw-r--r--src/shared/util.h3
4 files changed, 24 insertions, 2 deletions
diff --git a/src/shared/skyriminfo.cpp b/src/shared/skyriminfo.cpp
index 6302cef3..26395e67 100644
--- a/src/shared/skyriminfo.cpp
+++ b/src/shared/skyriminfo.cpp
@@ -27,6 +27,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include "error_report.h"
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
+#include <Shlwapi.h>
#include <boost/assign.hpp>
namespace MOShared {
@@ -36,6 +37,11 @@ SkyrimInfo::SkyrimInfo(const std::wstring &omoDirectory, const std::wstring &gam
: GameInfo(omoDirectory, gameDirectory)
{
identifyMyGamesDirectory(L"skyrim");
+
+ wchar_t appDataPath[MAX_PATH];
+ if (SUCCEEDED(SHGetFolderPathW(NULL, CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, appDataPath))) {
+ m_AppData = appDataPath;
+ }
}
bool SkyrimInfo::identifyGame(const std::wstring &searchPath)
@@ -258,8 +264,12 @@ bool SkyrimInfo::rerouteToProfile(const wchar_t *fileName, const wchar_t *fullPa
}
}
+if (_wcsicmp(fileName, L"plugins.txt") == 0) {
+ log("plugins.txt expected in \"%ls\", got \"%ls\"", m_AppData.c_str(), fullPath);
+}
+
if ((_wcsicmp(fileName, L"plugins.txt") == 0) &&
- (wcsstr(fullPath, L"AppData") != NULL)){
+ (m_AppData.empty() || (StrStrIW(fullPath, m_AppData.c_str()) != NULL))) {
return true;
}
diff --git a/src/shared/skyriminfo.h b/src/shared/skyriminfo.h
index b12a5d58..024d0395 100644
--- a/src/shared/skyriminfo.h
+++ b/src/shared/skyriminfo.h
@@ -97,6 +97,10 @@ private:
static bool identifyGame(const std::wstring &searchPath);
+private:
+
+ std::wstring m_AppData;
+
};
} // namespace MOShared
diff --git a/src/shared/util.cpp b/src/shared/util.cpp
index a6378a74..e61ae8a6 100644
--- a/src/shared/util.cpp
+++ b/src/shared/util.cpp
@@ -79,6 +79,13 @@ std::string &ToLower(std::string &text)
return text;
}
+std::string ToLower(const std::string &text)
+{
+ std::string temp = text;
+
+ std::transform(temp.begin(), temp.end(), temp.begin(), tolower);
+ return temp;
+}
std::wstring &ToLower(std::wstring &text)
{
diff --git a/src/shared/util.h b/src/shared/util.h
index 9c59f6db..80983cb0 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -39,8 +39,9 @@ std::string ToString(const std::wstring &source, bool utf8);
std::wstring ToWString(const std::string &source, bool utf8);
std::string &ToLower(std::string &text);
-std::wstring &ToLower(std::wstring &text);
+std::string ToLower(const std::string &text);
+std::wstring &ToLower(std::wstring &text);
std::wstring ToLower(const std::wstring &text);
VS_FIXEDFILEINFO GetFileVersion(const std::wstring &fileName);