aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-07-30 19:16:02 +0000
committerGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-07-30 19:16:02 +0000
commitf1478f88031234ce21627f857e2a4912b96210e0 (patch)
treeb6a9df5215b54f13539f5bb11ac1261a94018953 /tools
parent80a4a60f96c33ccd850f9b0eb4b69ab08c198196 (diff)
Fix skdiff when using windows path that begins with a drive letter
Diffstat (limited to 'tools')
-rw-r--r--tools/skdiff_main.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/tools/skdiff_main.cpp b/tools/skdiff_main.cpp
index 9017f64757..d10ebfc28d 100644
--- a/tools/skdiff_main.cpp
+++ b/tools/skdiff_main.cpp
@@ -1047,11 +1047,20 @@ static void print_diff_page (const int matchCount,
// Need to convert paths from relative-to-cwd to relative-to-outputDir
// FIXME this doesn't work if there are '..' inside the outputDir
- unsigned int ui;
+
+ bool pathFromRoot;
+#ifdef SK_BUILD_FOR_WIN32
+ pathFromRoot = outputDir.size() > 1 && ':' == outputDir[1];
+#else
+ pathFromRoot = outputDir.size() > 0 && PATH_DIV_CHAR == outputDir[0];
+#endif
SkString relativePath;
- for (ui = 0; ui < outputDir.size(); ui++) {
- if (outputDir[ui] == PATH_DIV_CHAR) {
- relativePath.append(".." PATH_DIV_STR);
+ if (!pathFromRoot) {
+ unsigned int ui;
+ for (ui = 0; ui < outputDir.size(); ui++) {
+ if (outputDir[ui] == PATH_DIV_CHAR) {
+ relativePath.append(".." PATH_DIV_STR);
+ }
}
}