Improve error messages about paths
Quote the path parameter in the message to distinguish it
from the text. This makes messages more understandable.
Before: source path include does not exist
After: source path "include" does not exist
Test: build Android
Change-Id: I99dbbce3cf090682a230d05bf120549a2cc7af3c
diff --git a/android/paths.go b/android/paths.go
index 4b35fef..0c65b83 100644
--- a/android/paths.go
+++ b/android/paths.go
@@ -244,7 +244,7 @@
}
path := filepath.Clean(p)
if !strings.HasPrefix(path, prefix) {
- reportPathErrorf(ctx, "Path '%s' is not in module source directory '%s'", p, prefix)
+ reportPathErrorf(ctx, "Path %q is not in module source directory %q", p, prefix)
continue
}
@@ -505,7 +505,7 @@
// absolute path already checked by validateSafePath
if strings.HasPrefix(ret.String(), ctx.Config().buildDir) {
- return ret, fmt.Errorf("source path %s is in output", ret.String())
+ return ret, fmt.Errorf("source path %q is in output", ret.String())
}
return ret, err
@@ -521,7 +521,7 @@
// absolute path already checked by validatePath
if strings.HasPrefix(ret.String(), ctx.Config().buildDir) {
- return ret, fmt.Errorf("source path %s is in output", ret.String())
+ return ret, fmt.Errorf("source path %q is in output", ret.String())
}
return ret, nil
@@ -575,7 +575,7 @@
} else if exists, _, err := ctx.Fs().Exists(path.String()); err != nil {
reportPathErrorf(ctx, "%s: %s", path, err.Error())
} else if !exists {
- reportPathErrorf(ctx, "source path %s does not exist", path)
+ reportPathErrorf(ctx, "source path %q does not exist", path)
}
return path
}
@@ -740,7 +740,7 @@
if exists, _, err := ctx.Fs().Exists(path.String()); err != nil {
reportPathErrorf(ctx, "%s: %s", path, err.Error())
} else if !exists {
- reportPathErrorf(ctx, "module source path %s does not exist", path)
+ reportPathErrorf(ctx, "module source path %q does not exist", path)
}
return path