summaryrefslogtreecommitdiff
path: root/tools/aapt2/cmd/Compile.cpp
diff options
context:
space:
mode:
authorRyan Mitchell <rtmitchell@google.com>2018-10-03 09:20:57 -0700
committerRyan Mitchell <rtmitchell@google.com>2018-10-03 11:35:37 -0700
commit0ce89734d111ce3a9529254ccc9b8ef33fdeba73 (patch)
tree94536a693f37675e6f662746c951c9227c4069c8 /tools/aapt2/cmd/Compile.cpp
parent88f0f6c9b1d2dfecd4f0bdb663f01a098a59fa83 (diff)
Fix failing Windows tests
Some tests were not written to run on Windows correctly. Compile also has a bug that caused using the --zip flag to fail on Windows. iswspace does count the non breaking space as Whiespace on Windows but not on Unix based systems Bug: 117156986 Change-Id: I999375162bdfdf86fb25992ee88e2962ab90b577 Test: aapt2_tests and wine aapt2_tests.exe
Diffstat (limited to 'tools/aapt2/cmd/Compile.cpp')
-rw-r--r--tools/aapt2/cmd/Compile.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/aapt2/cmd/Compile.cpp b/tools/aapt2/cmd/Compile.cpp
index 62c19fbfcdd3..8060a8de4629 100644
--- a/tools/aapt2/cmd/Compile.cpp
+++ b/tools/aapt2/cmd/Compile.cpp
@@ -73,9 +73,9 @@ struct ResourcePathData {
};
// Resource file paths are expected to look like: [--/res/]type[-config]/name
-static Maybe<ResourcePathData> ExtractResourcePathData(const std::string& path,
+static Maybe<ResourcePathData> ExtractResourcePathData(const std::string& path, const char dir_sep,
std::string* out_error) {
- std::vector<std::string> parts = util::Split(path, file::sDirSep);
+ std::vector<std::string> parts = util::Split(path, dir_sep);
if (parts.size() < 2) {
if (out_error) *out_error = "bad resource path";
return {};
@@ -656,7 +656,7 @@ int Compile(IAaptContext* context, io::IFileCollection* inputs, IArchiveWriter*
// Extract resource type information from the full path
std::string err_str;
ResourcePathData path_data;
- if (auto maybe_path_data = ExtractResourcePathData(path, &err_str)) {
+ if (auto maybe_path_data = ExtractResourcePathData(path, inputs->GetDirSeparator(), &err_str)) {
path_data = maybe_path_data.value();
} else {
context->GetDiagnostics()->Error(DiagMessage(file->GetSource()) << err_str);
@@ -731,7 +731,7 @@ int CompileCommand::Action(const std::vector<std::string>& args) {
// Collect the resources files to compile
if (options_.res_dir && options_.res_zip) {
context.GetDiagnostics()->Error(DiagMessage()
- << "only one of --dir and --zip can be specified");
+ << "only one of --dir and --zip can be specified");
return 1;
} else if (options_.res_dir) {
if (!args.empty()) {