commit a48d21db67b9751d2cfe1bd75b1b1ef01d6e998d
parent 6a1d9a571678409b0eccdf6d228a4147333da640
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date: Fri, 25 Mar 2022 19:38:02 +0100
fix skin files not correctly loaded from disk
Diffstat:
3 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/source/jucePlugin/ui3/VirusEditor.cpp b/source/jucePlugin/ui3/VirusEditor.cpp
@@ -171,7 +171,7 @@ namespace genericVirusUI
return res;
const auto modulePath = synthLib::getModulePath();
- const auto folder = m_skinFolder.find(modulePath) == 0 ? m_skinFolder : modulePath + m_skinFolder;
+ const auto folder = synthLib::validatePath(m_skinFolder.find(modulePath) == 0 ? m_skinFolder : modulePath + m_skinFolder);
// try to load from disk first
FILE* hFile = fopen((folder + _name).c_str(), "rb");
diff --git a/source/synthLib/os.cpp b/source/synthLib/os.cpp
@@ -90,7 +90,7 @@ namespace synthLib
if (end != std::string::npos)
path = path.substr(0, end + 1);
- return path;
+ return validatePath(path);
}
std::string getCurrentDirectory()
@@ -113,6 +113,16 @@ namespace synthLib
#endif
}
+ std::string validatePath(std::string _path)
+ {
+ if(_path.empty())
+ return _path;
+ if(_path.back() == '/' || _path.back() == '\\')
+ return _path;
+ _path += '/';
+ return _path;
+ }
+
bool getDirectoryEntries(std::vector<std::string>& _files, const std::string& _folder)
{
#ifdef USE_DIRENT
diff --git a/source/synthLib/os.h b/source/synthLib/os.h
@@ -8,6 +8,7 @@ namespace synthLib
std::string getCurrentDirectory();
bool createDirectory(const std::string& _dir);;
+ std::string validatePath(std::string _path);
bool getDirectoryEntries(std::vector<std::string>& _files, const std::string& _folder);