summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorTannin <devnull@localhost>2014-05-31 13:43:48 +0200
committerTannin <devnull@localhost>2014-05-31 13:43:48 +0200
commit1eb783aae348f906056cee17cb65dfd507429901 (patch)
treed9e5b93c1d528a2182416d971b27e49cb524532b /src/shared
parent93a19799b86dd6e12a186e84eb43699b318b214d (diff)
- added a new mod type that represents files handled externally (i.e. DLCs) as mods in MO
- hashes of file names in bsa files are no longer checked all the time - author and description is now read from esp files - rewrote the code that fixes modlists after a rename, should be a bit more robust - fixes to qt 5 and msvc 2013 compatibility - started to update the tutorial (not done yet!) - bugfix: counter for the problems badge wasn't calculated correctly
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/directoryentry.cpp12
-rw-r--r--src/shared/directoryentry.h3
2 files changed, 9 insertions, 6 deletions
diff --git a/src/shared/directoryentry.cpp b/src/shared/directoryentry.cpp
index 6311ba25..b7863284 100644
--- a/src/shared/directoryentry.cpp
+++ b/src/shared/directoryentry.cpp
@@ -443,10 +443,12 @@ FilesOrigin &DirectoryEntry::createOrigin(const std::wstring &originName, const
void DirectoryEntry::addFromOrigin(const std::wstring &originName, const std::wstring &directory, int priority)
{
FilesOrigin &origin = createOrigin(originName, directory, priority);
- boost::scoped_array<wchar_t> buffer(new wchar_t[MAXPATH_UNICODE + 1]);
- memset(buffer.get(), L'\0', MAXPATH_UNICODE + 1);
- int offset = _snwprintf(buffer.get(), MAXPATH_UNICODE, L"%ls", directory.c_str());
- addFiles(origin, buffer.get(), offset);
+ if (directory.length() != 0) {
+ boost::scoped_array<wchar_t> buffer(new wchar_t[MAXPATH_UNICODE + 1]);
+ memset(buffer.get(), L'\0', MAXPATH_UNICODE + 1);
+ int offset = _snwprintf(buffer.get(), MAXPATH_UNICODE, L"%ls", directory.c_str());
+ addFiles(origin, buffer.get(), offset);
+ }
m_Populated = true;
}
@@ -461,7 +463,7 @@ void DirectoryEntry::addFromBSA(const std::wstring &originName, std::wstring &di
}
BSA::Archive archive;
- BSA::EErrorCode res = archive.read(ToString(fileName, false).c_str());
+ BSA::EErrorCode res = archive.read(ToString(fileName, false).c_str(), false);
if ((res != BSA::ERROR_NONE) && (res != BSA::ERROR_INVALIDHASHES)) {
std::ostringstream stream;
stream << "invalid bsa file: " << ToString(fileName, false) << " errorcode " << res << " - " << ::GetLastError();
diff --git a/src/shared/directoryentry.h b/src/shared/directoryentry.h
index f691603f..7b656b05 100644
--- a/src/shared/directoryentry.h
+++ b/src/shared/directoryentry.h
@@ -273,6 +273,8 @@ public:
bool hasContentsFromOrigin(int originID) const;
+ FilesOrigin &createOrigin(const std::wstring &originName, const std::wstring &directory, int priority);
+
private:
DirectoryEntry(const DirectoryEntry &reference);
@@ -292,7 +294,6 @@ private:
origin.addFile(file->getIndex());
}
- FilesOrigin &createOrigin(const std::wstring &originName, const std::wstring &directory, int priority);
void addFiles(FilesOrigin &origin, wchar_t *buffer, int bufferOffset);
void addFiles(FilesOrigin &origin, BSA::Folder::Ptr archiveFolder, FILETIME &fileTime, const std::wstring &archiveName);