diff options
| author | 2021-11-08 12:57:40 +0000 | |
|---|---|---|
| committer | 2021-11-10 10:42:05 +0000 | |
| commit | 9109a415b28aea8bf3bf668acbbbcdc28ca197ac (patch) | |
| tree | 988b8eff7b6a020f6b5ca0ec79633308b6ee246a | |
| parent | eaebd2cd546f13c1082c092f522cf11dbc2eea9f (diff) | |
AAPT Files - Permit invariant filepaths for getting file names
AAPT compile provides a "--source-path" option that instructs aapt to
use a provided source path rather than the default source resource as
resource orgin. However, this is not file system agnostic. This causes
incorrect outputs of AAPT link, as source path parsing is tied to the
file system. This change ensures that AAPT Files::getFilename can parse
filepaths, regardless of file system filepath type.
Bug: 141301405, 155218379
Test: manually tested on windows with a unix style filepath, passes aapt
tests
Change-Id: I548de01ad513b549dc30eb35d2a59813fa3d4e69
| -rw-r--r-- | tools/aapt2/util/Files.cpp | 2 | ||||
| -rw-r--r-- | tools/aapt2/util/Files.h | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/tools/aapt2/util/Files.cpp b/tools/aapt2/util/Files.cpp index 5d57de6a9fb1..be09545abb45 100644 --- a/tools/aapt2/util/Files.cpp +++ b/tools/aapt2/util/Files.cpp @@ -154,7 +154,7 @@ StringPiece GetFilename(const StringPiece& path) { const char* end = path.end(); const char* last_dir_sep = path.begin(); for (const char* c = path.begin(); c != end; ++c) { - if (*c == sDirSep) { + if (*c == sDirSep || *c == sInvariantDirSep) { last_dir_sep = c + 1; } } diff --git a/tools/aapt2/util/Files.h b/tools/aapt2/util/Files.h index 481a4cdb6ad0..e50cb505bf66 100644 --- a/tools/aapt2/util/Files.h +++ b/tools/aapt2/util/Files.h @@ -41,6 +41,8 @@ constexpr const char sDirSep = '/'; constexpr const char sPathSep = ':'; #endif +constexpr const char sInvariantDirSep = '/'; + enum class FileType { kUnknown = 0, kNonexistant, |