Merge "Improve error message for missing path + local dir"
diff --git a/bpfix/bpfix/bpfix.go b/bpfix/bpfix/bpfix.go
index c0925fe..7461a18 100644
--- a/bpfix/bpfix/bpfix.go
+++ b/bpfix/bpfix/bpfix.go
@@ -1484,7 +1484,7 @@
ok := hasFile(relativePath+"/Android.mk", fs)
// some modules in the existing test cases in the androidmk_test.go do not have a valid path
if !ok && len(relativePath) > 0 {
- return fmt.Errorf("Cannot find an Android.mk file at path %s", relativePath)
+ return fmt.Errorf("Cannot find an Android.mk file at path %q", relativePath)
}
licenseKindsPropertyName := "android_license_kinds"
@@ -1661,9 +1661,12 @@
// if empty
return "", fmt.Errorf("Cannot find the value of the %s.%s property", mod.Type, property)
}
+ if relativePath == "" {
+ relativePath = "."
+ }
_, isDir, _ := fs.Exists(relativePath)
if !isDir {
- return "", fmt.Errorf("Cannot find the path %s", relativePath)
+ return "", fmt.Errorf("Cannot find the path %q", relativePath)
}
path := relativePath
for {
@@ -1675,7 +1678,7 @@
}
_, isDir, _ = fs.Exists(path)
if !isDir {
- return "", fmt.Errorf("Cannot find the path %s", path)
+ return "", fmt.Errorf("Cannot find the path %q", path)
}
return path, nil
}
diff --git a/bpfix/bpfix/bpfix_test.go b/bpfix/bpfix/bpfix_test.go
index 221df45..3063f9d 100644
--- a/bpfix/bpfix/bpfix_test.go
+++ b/bpfix/bpfix/bpfix_test.go
@@ -1936,7 +1936,7 @@
fs: mockFs,
path: relativePathErr,
expectedErr: `
- Cannot find an Android.mk file at path a/b/c
+ Cannot find an Android.mk file at path "a/b/c"
`,
},
}