Improvements to file uploads. UI improvements for future looper and audio capture plugins.

This commit is contained in:
Robin E. R. Davies
2025-02-15 12:29:53 -05:00
parent b07f590b49
commit 09f73e26d6
41 changed files with 1714 additions and 626 deletions
+53
View File
@@ -21,6 +21,7 @@
* SOFTWARE.
*/
#include "util.hpp"
#include "ss.hpp"
#include <pthread.h>
#include <thread>
@@ -136,3 +137,55 @@ std::vector<std::string> pipedal::split(const std::string &value, char delimiter
}
return result;
}
bool pipedal::IsChildDirectory(const std::filesystem::path &path, const std::filesystem::path&rootPath)
{
auto iter = path.begin();
for (auto i = rootPath.begin(); i != rootPath.end(); ++i)
{
if (iter == path.end() || *iter != *i)
{
return false;
}
++iter;
}
return true;
}
std::string pipedal::ToLower(const std::string&value)
{
std::string result;
result.resize(value.length());
for (size_t i = 0; i < value.length(); ++i)
{
result[i] = (char)tolower(value[i]);
}
return result;
}
std::filesystem::path pipedal::MakeRelativePath(const std::filesystem::path &path, const std::filesystem::path&parentPath)
{
if (path.is_relative()) return path;
auto iter = path.begin();
for (auto i = parentPath.begin(); i != parentPath.end(); ++i)
{
if (iter == path.end() || *iter != *i) {
// not a child directory of parent directory.
throw std::runtime_error("Not a child directory.");
}
++iter;
}
std::filesystem::path remander;
while (iter != path.end())
{
remander /= *iter++;
}
return remander;
}