Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More Filesize 0 changes #803

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/resource/ResourceManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ std::shared_ptr<IResource> ResourceManager::LoadResourceProcess(const ResourceId
auto file = LoadFileProcess(identifier.Path, initData);
if (file == nullptr) {
SPDLOG_TRACE("Failed to load resource file at path {}", identifier.Path);
return nullptr;
}

// Transform the raw data into a resource
Expand Down
2 changes: 1 addition & 1 deletion src/resource/archive/Archive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ std::shared_ptr<File> Archive::LoadFile(const std::string& filePath, std::shared
} else {
fileToLoad = LoadFileRaw(filePath);
if (fileToLoad == nullptr) {
SPDLOG_ERROR("Failed to load file at path {}.", filePath);
SPDLOG_TRACE("Failed to load file at path {}.", filePath);
return nullptr;
}
fileToLoad->InitData = ReadResourceInitDataLegacy(filePath, fileToLoad);
Expand Down
6 changes: 6 additions & 0 deletions src/resource/archive/O2rArchive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ std::shared_ptr<File> O2rArchive::LoadFileRaw(const std::string& filePath) {
return nullptr;
}

// Filesize 0, no logging needed
if (zipEntryStat.size == 0) {
SPDLOG_TRACE("({}) Failed to load file {}; filesize 0", GetLastError(), filePath, GetPath());
return nullptr;
}

struct zip_file* zipEntryFile = zip_fopen_index(mZipArchive, zipEntryIndex, 0);
if (!zipEntryFile) {
SPDLOG_TRACE("Failed to open file {} in zip archive {}.", filePath, GetPath());
Expand Down
4 changes: 4 additions & 0 deletions src/resource/archive/OtrArchive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ std::shared_ptr<File> OtrArchive::LoadFileRaw(const std::string& filePath) {

auto fileToLoad = std::make_shared<File>();
DWORD fileSize = SFileGetFileSize(fileHandle, 0);
if (fileSize == 0) {
SPDLOG_TRACE("({}) Failed to load file {}; filesize 0", GetLastError(), filePath, GetPath());
return nullptr;
}
DWORD readBytes;
fileToLoad->Buffer = std::make_shared<std::vector<char>>(fileSize);
bool readFileSuccess = SFileReadFile(fileHandle, fileToLoad->Buffer->data(), fileSize, &readBytes, NULL);
Expand Down
Loading