mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-10 21:16:24 +02:00
Nicer logging if no texture.zip file is there
This commit is contained in:
1 parent
2f1441eceb
commit
8484dd4917
3 files changed
+12
-5
No files matched your search
@@ -15,13 +15,15 @@
|
||||
#include "Common/File/VFS/ZipFileReader.h"
|
||||
#include "Common/StringUtils.h"
|
||||
|
||||
ZipFileReader *ZipFileReader::Create(const Path &zipFile, const char *inZipPath) {
|
||||
ZipFileReader *ZipFileReader::Create(const Path &zipFile, const char *inZipPath, bool logErrors) {
|
||||
int error = 0;
|
||||
zip *zip_file;
|
||||
if (zipFile.Type() == PathType::CONTENT_URI) {
|
||||
int fd = File::OpenFD(zipFile, File::OPEN_READ);
|
||||
if (!fd) {
|
||||
ERROR_LOG(IO, "Failed to open FD for %s as zip file", zipFile.c_str());
|
||||
if (logErrors) {
|
||||
ERROR_LOG(IO, "Failed to open FD for '%s' as zip file", zipFile.c_str());
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
zip_file = zip_fdopen(fd, 0, &error);
|
||||
@@ -30,7 +32,9 @@ ZipFileReader *ZipFileReader::Create(const Path &zipFile, const char *inZipPath)
|
||||
}
|
||||
|
||||
if (!zip_file) {
|
||||
ERROR_LOG(IO, "Failed to open %s as a zip file", zipFile.c_str());
|
||||
if (logErrors) {
|
||||
ERROR_LOG(IO, "Failed to open %s as a zip file", zipFile.c_str());
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
class ZipFileReader : public VFSBackend {
|
||||
public:
|
||||
static ZipFileReader *Create(const Path &zipFile, const char *inZipPath);
|
||||
static ZipFileReader *Create(const Path &zipFile, const char *inZipPath, bool logErrors = true);
|
||||
~ZipFileReader();
|
||||
|
||||
bool IsValid() const { return zip_file_ != nullptr; }
|
||||
|
||||
@@ -124,9 +124,12 @@ bool TextureReplacer::LoadIni() {
|
||||
delete vfs_;
|
||||
vfs_ = nullptr;
|
||||
|
||||
Path zipPath = basePath_ / ZIP_FILENAME;
|
||||
|
||||
// First, check for textures.zip, which is used to reduce IO.
|
||||
VFSBackend *dir = ZipFileReader::Create(basePath_ / ZIP_FILENAME, "");
|
||||
VFSBackend *dir = ZipFileReader::Create(zipPath, "", false);
|
||||
if (!dir) {
|
||||
INFO_LOG(G3D, "%s wasn't a zip file - opening the directory %s instead.", zipPath.c_str(), basePath_.c_str());
|
||||
vfsIsZip_ = false;
|
||||
dir = new DirectoryReader(basePath_);
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user