diff options
| author | Luca Stefani <luca.stefani.ge1@gmail.com> | 2020-03-07 13:13:34 +0100 |
|---|---|---|
| committer | Luca Stefani <luca.stefani.ge1@gmail.com> | 2020-03-07 13:13:34 +0100 |
| commit | 4dac9eee3f43e0fa62015d6f7a318ec05f63bc63 (patch) | |
| tree | 8b9352758716535ce05ca458aebed4bb57037e59 /android/paths.go | |
| parent | a8b49b207d563ef1f563176978394c06e909ee93 (diff) | |
| parent | e65de78c9ad4109022266b51edfc5546afd0ef95 (diff) | |
| download | build_soong-4dac9eee3f43e0fa62015d6f7a318ec05f63bc63.tar.gz build_soong-4dac9eee3f43e0fa62015d6f7a318ec05f63bc63.tar.bz2 build_soong-4dac9eee3f43e0fa62015d6f7a318ec05f63bc63.zip | |
Merge tag 'android-10.0.0_r31' into lineage-17.1-android-10.0.0_r31
Android 10.0.0 release 31
* tag 'android-10.0.0_r31':
Revert submission 9940985-qpr1-dev merge
Revert submission 9919844-manual r1 merge
DO NOT MERGE: Add tradefed_java_library_host
DO NOT MERGE: Add tradefed_java_library_host
DO NOT MERGE: Add tradefed_java_library_host
Switch to clang-r353983c1.
Switch to clang-r353983d
Shard gensrcs modules into multiple commands
Move sharding functions for reuse
Rewrite depfile from sbox to stay reproducible
Support RuleBuilder.Sbox to wrap commands in sbox
Update droidstubs build target
Change-Id: Iff6698461ec43d1c74e70e3a693ebd028fe7b8b7
Diffstat (limited to 'android/paths.go')
| -rw-r--r-- | android/paths.go | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/android/paths.go b/android/paths.go index 8583daa5..edddce90 100644 --- a/android/paths.go +++ b/android/paths.go @@ -1320,16 +1320,23 @@ func Rel(ctx PathContext, basePath string, targetPath string) string { // MaybeRel performs the same function as filepath.Rel, but reports errors to a PathContext, and returns false if // targetPath is not inside basePath. func MaybeRel(ctx PathContext, basePath string, targetPath string) (string, bool) { + rel, isRel, err := maybeRelErr(basePath, targetPath) + if err != nil { + reportPathError(ctx, err) + } + return rel, isRel +} + +func maybeRelErr(basePath string, targetPath string) (string, bool, error) { // filepath.Rel returns an error if one path is absolute and the other is not, handle that case first. if filepath.IsAbs(basePath) != filepath.IsAbs(targetPath) { - return "", false + return "", false, nil } rel, err := filepath.Rel(basePath, targetPath) if err != nil { - reportPathError(ctx, err) - return "", false + return "", false, err } else if rel == ".." || strings.HasPrefix(rel, "../") || strings.HasPrefix(rel, "/") { - return "", false + return "", false, nil } - return rel, true + return rel, true, nil } |
