commit c44241ccf89b48d76ac57abc6abfa103f4b6e82c
parent 36c863c700068cdcef55deec0508ca5a7158aaf4
Author: cfillion <cfillion@users.noreply.github.com>
Date: Thu, 25 Aug 2016 16:59:04 -0400
write data files directly into the Data directory
Diffstat:
2 files changed, 8 insertions(+), 16 deletions(-)
diff --git a/src/source.cpp b/src/source.cpp
@@ -109,7 +109,6 @@ Path Source::targetPath() const
switch(type) {
case Package::ScriptType:
case Package::EffectType:
- case Package::DataType:
path.append(cat->index()->name());
// only allow directory traversal up to the index name
@@ -117,6 +116,7 @@ Path Source::targetPath() const
break;
case Package::ExtensionType:
case Package::ThemeType:
+ case Package::DataType:
path.append(file(), false);
break;
case Package::UnknownType:
diff --git a/test/source.cpp b/test/source.cpp
@@ -110,46 +110,38 @@ TEST_CASE("full name with version", M) {
TEST_CASE("source target path", M) {
Index ri("Index Name");
Category cat("Category Name", &ri);
- Package pack(Package::ScriptType, "package name", &cat);
+ Package pack(Package::UnknownType, "package name", &cat);
Version ver("1.0", &pack);
Source source("file.name", "url", &ver);
- Path expected;
- expected.append("Index Name");
- expected.append("Category Name");
- expected.append("file.name");
-
SECTION("script") {
- expected.prepend("Scripts");
+ source.setTypeOverride(Package::ScriptType);
+ const Path expected("Scripts/Index Name/Category Name/file.name");
REQUIRE(source.targetPath() == expected);
}
SECTION("effect") {
- expected.prepend("Effects");
source.setTypeOverride(Package::EffectType);
+ const Path expected("Effects/Index Name/Category Name/file.name");
REQUIRE(source.targetPath() == expected);
}
SECTION("extension") {
- expected.clear();
- expected.append("UserPlugins");
- expected.append("file.name");
source.setTypeOverride(Package::ExtensionType);
+ const Path expected("UserPlugins/file.name");
REQUIRE(source.targetPath() == expected);
}
SECTION("data") {
- expected.prepend("Data");
source.setTypeOverride(Package::DataType);
+ const Path expected("Data/file.name");
REQUIRE(source.targetPath() == expected);
}
SECTION("theme") {
- expected.clear();
- expected.append("ColorThemes");
- expected.append("file.name");
source.setTypeOverride(Package::ThemeType);
+ const Path expected("ColorThemes/file.name");
REQUIRE(source.targetPath() == expected);
}
}