diff --git a/kramv/KramViewerBase.cpp b/kramv/KramViewerBase.cpp index 02b23eb..320f091 100644 --- a/kramv/KramViewerBase.cpp +++ b/kramv/KramViewerBase.cpp @@ -2095,6 +2095,34 @@ void Data::setLoadedText(string& text) } } +void Data::setFailedText(const string& filename, string& text) +{ + text = "Failed "; + + // This doesn't advance with failure + //string filename = _showSettings->lastFilename; + + text += toFilenameShort(filename.c_str()); + + // archives and file systems have folders, split that off + string folderName; + const char* slashPos = strrchr(filename.c_str(), '/'); + if (slashPos != nullptr) { + folderName = filename.substr(0, slashPos - filename.c_str()); + } + + if (!folderName.empty()) { + text += " in folder "; + text += folderName; + } + + if (!_archiveName.empty()) { + text += " from archive "; + text += _archiveName; + } + +} + void Data::initActions() { // Don't reorder without also matching actionPtrs below diff --git a/kramv/KramViewerBase.h b/kramv/KramViewerBase.h index a9ba273..03e96f6 100644 --- a/kramv/KramViewerBase.h +++ b/kramv/KramViewerBase.h @@ -485,7 +485,8 @@ struct Data { const Action* actionFromKey(uint32_t keyCodes) const; void setLoadedText(string& text); - + void setFailedText(const string& filename, string& text); + void initActions(); vector& actions() { return _actions; } void initDisabledButtons(); diff --git a/kramv/KramViewerMain.mm b/kramv/KramViewerMain.mm index 9e1467f..c35ee45 100644 --- a/kramv/KramViewerMain.mm +++ b/kramv/KramViewerMain.mm @@ -1579,8 +1579,8 @@ -(BOOL)loadFile setErrorLogCapture(false); string finalErrorText; - append_sprintf(finalErrorText, "Could not load from file:\n %s\n", - filename); + // this does have previous filename set + _data.setFailedText(file.name.c_str(), finalErrorText); finalErrorText += errorText; [self setHudText:finalErrorText.c_str()]; diff --git a/libkram/kram/KTXImage.cpp b/libkram/kram/KTXImage.cpp index 047dbde..321272e 100644 --- a/libkram/kram/KTXImage.cpp +++ b/libkram/kram/KTXImage.cpp @@ -17,7 +17,7 @@ #include "zstd.h" #ifndef USE_LIBCOMPRESSION -#define USE_LIBCOMPRESSION (KRAM_MAC || KRAM_IOS) +#define USE_LIBCOMPRESSION 0 // (KRAM_MAC || KRAM_IOS) #endif #if USE_LIBCOMPRESSION diff --git a/libkram/kram/KramZipHelper.cpp b/libkram/kram/KramZipHelper.cpp index f02d51f..f8038d5 100644 --- a/libkram/kram/KramZipHelper.cpp +++ b/libkram/kram/KramZipHelper.cpp @@ -9,8 +9,9 @@ // test for perf of this compared to one in miniz also see // comments about faster algs. // libcompress can only encode lvl 5, but here it's only decompress. +// This is failing on various ktx2 files in the mac archive #ifndef USE_LIBCOMPRESSION -#define USE_LIBCOMPRESSION (KRAM_MAC || KRAM_IOS) +#define USE_LIBCOMPRESSION 0 // (KRAM_MAC || KRAM_IOS) #endif #if USE_LIBCOMPRESSION