Added nuake wren modules path detection, removed project stuff

This commit is contained in:
Antoine Pilote
2021-07-03 16:00:13 -04:00
parent 2fff0594b0
commit f5bcb12f61
23 changed files with 37 additions and 533 deletions

View File

@@ -56,23 +56,29 @@ bool hasEnding(std::string const& fullString, std::string const& ending) {
}
}
WrenLoadModuleResult myLoadModule(WrenVM* vm, const char* name) {
const std::string NuakeModulePrefix = "Nuake:";
WrenLoadModuleResult myLoadModule(WrenVM* vm, const char* name)
{
WrenLoadModuleResult result = { 0 };
std::string sname = name;
std::string s = "tititoto";
std::string sname = std::string(name);
std::string path = "resources/" + std::string(name);
if (s.rfind("Nuake/", 0) == 0)
bool isAbsolute = false;
if (sname.rfind(NuakeModulePrefix, 0) == 0)
{
path = "resources/" + std::string(name);
size_t prefixPosition = sname.find(NuakeModulePrefix);
sname.erase(prefixPosition, NuakeModulePrefix.length());
path = "resources/Scripts/" + std::string(sname);
}
else
{
path = FileSystem::Root + name;
isAbsolute = true;
}
if(!hasEnding(path, ".wren"))
if (!hasEnding(path, ".wren"))
path += ".wren";
std::string str = FileSystem::ReadFile(path, true);