commit 7bdceaec140feaea4a9f4751863ca2bfac830370
parent 4d81364926c37a4d17c25928b31505d86079bc6c
Author: cfillion <cfillion@users.noreply.github.com>
Date: Sun, 14 Feb 2016 00:31:11 -0500
add naive support for extension packages
Diffstat:
3 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/src/package.cpp b/src/package.cpp
@@ -28,6 +28,8 @@ Package::Type Package::typeFor(const char *type)
{
if(!strcmp(type, "script"))
return ScriptType;
+ else if(!strcmp(type, "extension"))
+ return ExtensionType;
else
return UnknownType;
}
@@ -94,6 +96,10 @@ Path Package::makeTargetPath(const string &file) const
// only allow directory traversal up to the index name
path += Path(m_category->name()) + file;
break;
+ case ExtensionType:
+ path.append("UserPlugins");
+ path.append(file, false);
+ break;
default:
// The package has an unsupported type, so we return an empty path.
// The empty path won't be used because the category will reject
diff --git a/src/package.hpp b/src/package.hpp
@@ -31,6 +31,7 @@ public:
enum Type {
UnknownType,
ScriptType,
+ ExtensionType,
};
static Type typeFor(const char *);
diff --git a/test/package.cpp b/test/package.cpp
@@ -129,6 +129,21 @@ TEST_CASE("script target path without category", M) {
}
}
+TEST_CASE("extension target path", M) {
+ RemoteIndex ri("Remote Name");
+ Category cat("Category Name", &ri);
+
+ Package pack(Package::ExtensionType, "file.name", &cat);
+
+ Path expected;
+ expected.append("UserPlugins");
+ REQUIRE(pack.makeTargetPath() == expected);
+
+ expected.append("reaper_reapack.dll");
+ REQUIRE(pack.makeTargetPath("../reaper_reapack.dll") == expected);
+}
+
+
TEST_CASE("full name", M) {
SECTION("no category") {
Package pack(Package::ScriptType, "file.name");