satdump/src-core/resources.cpp

31 lines
977 B
C++
Raw Normal View History

2021-05-28 18:57:15 +02:00
#include "resources.h"
#include <filesystem>
#include "satdump_vars.h"
#include "logger.h"
2021-05-28 18:57:15 +02:00
namespace resources
{
bool resourceExists(std::string resource)
{
if (std::filesystem::exists("resources"))
return std::filesystem::exists("resources/" + resource);
else
return std::filesystem::exists(satdump::RESPATH + "resources/" + resource);
2021-05-28 18:57:15 +02:00
}
std::string getResourcePath(std::string resource)
{
if (std::filesystem::exists("resources"))
{
if (!std::filesystem::exists("resources/" + resource))
logger->error("Resources " + resource + " does not exist!");
2021-05-28 18:57:15 +02:00
return "resources/" + resource;
}
2021-05-28 18:57:15 +02:00
else
{
if (!std::filesystem::exists(satdump::RESPATH + "resources/" + resource))
logger->error("Resources " + resource + " does not exist!");
return satdump::RESPATH + "resources/" + resource;
}
2021-05-28 18:57:15 +02:00
}
}