From 07eb6523deaa89334bd72f1efc3c30d4df1c02cb Mon Sep 17 00:00:00 2001 From: chiteroman Date: Sat, 11 Jan 2025 11:37:44 +0100 Subject: [PATCH] Check if paths exists --- app/src/main/cpp/main.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/src/main/cpp/main.cpp b/app/src/main/cpp/main.cpp index 59082a4..897432e 100644 --- a/app/src/main/cpp/main.cpp +++ b/app/src/main/cpp/main.cpp @@ -449,10 +449,15 @@ static void companion(int fd) { std::vector dex, json; - dex = readFile(DEX_PATH); + if (std::filesystem::exists(DEX_PATH)) { + dex = readFile(DEX_PATH); + } - json = readFile(PIF_JSON); - if (json.empty()) json = readFile(PIF_JSON_DEFAULT); + if (std::filesystem::exists(PIF_JSON)) { + json = readFile(PIF_JSON); + } else if (std::filesystem::exists(PIF_JSON_DEFAULT)) { + json = readFile(PIF_JSON_DEFAULT); + } int dexSize = static_cast(dex.size()); int jsonSize = static_cast(json.size());