From 1c8575e40c202b668c51e6038ff2e41cd6449088 Mon Sep 17 00:00:00 2001 From: Bruno Herbelin Date: Mon, 18 Apr 2022 14:01:50 +0200 Subject: [PATCH] Add test of resource availability --- Resource.cpp | 8 +++++++- Resource.h | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Resource.cpp b/Resource.cpp index ee212a3..7d32081 100644 --- a/Resource.cpp +++ b/Resource.cpp @@ -314,7 +314,7 @@ uint Resource::getTextureImage(const std::string& path, float *aspect_ratio) std::string Resource::listDirectory() { - // enter icons directory + // enter directory auto fs = cmrc::vmix::get_filesystem(); cmrc::directory_iterator it = fs.iterate_directory(""); cmrc::directory_iterator itend = it.end(); @@ -335,3 +335,9 @@ std::string Resource::listDirectory() return ls; } + +bool Resource::hasPath(const std::string& path) +{ + auto fs = cmrc::vmix::get_filesystem(); + return fs.exists(path); +} diff --git a/Resource.h b/Resource.h index 68b5574..8a819a8 100644 --- a/Resource.h +++ b/Resource.h @@ -35,6 +35,9 @@ namespace Resource // list files in resource directory std::string listDirectory(); + // tests if a resource path is available + bool hasPath(const std::string& path); + } #endif /* __RSC_MANAGER_H_ */