Make skdiff paths work on windows
http://codereview.appspot.com/5111041/
git-svn-id: http://skia.googlecode.com/svn/trunk@2321 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tools/skdiff_main.cpp b/tools/skdiff_main.cpp
index a024a76..04b0dc0 100644
--- a/tools/skdiff_main.cpp
+++ b/tools/skdiff_main.cpp
@@ -32,6 +32,14 @@
* images into the second directory, also writing index.html there.
*/
+#if SK_BUILD_FOR_WIN32
+ #define PATH_DIV_STR "\\"
+ #define PATH_DIV_CHAR '\\'
+#else
+ #define PATH_DIV_STR "/"
+ #define PATH_DIV_CHAR '/'
+#endif
+
struct DiffRecord {
DiffRecord (const SkString filename,
const SkString basePath,
@@ -481,8 +489,8 @@
}
SkString fullname (dirname);
fullname.append(newdirname);
- if (!fullname.endsWith("/")) {
- fullname.append("/");
+ if (!fullname.endsWith(PATH_DIV_STR)) {
+ fullname.append(PATH_DIV_STR);
}
analyze_chromium(dmp, colorThreshold, differences,
fullname, outputDir, summary);
@@ -610,8 +618,8 @@
unsigned int ui;
SkString relativePath;
for (ui = 0; ui < outputDir.size(); ui++) {
- if (outputDir[ui] == '/') {
- relativePath.append("../");
+ if (outputDir[ui] == PATH_DIV_CHAR) {
+ relativePath.append(".." PATH_DIV_STR);
}
}
@@ -625,10 +633,10 @@
if (0 == diff->fFractionDifference) {
continue;
}
- if (!diff->fBasePath.startsWith("/")) {
+ if (!diff->fBasePath.startsWith(PATH_DIV_STR)) {
diff->fBasePath.prepend(relativePath);
}
- if (!diff->fComparisonPath.startsWith("/")) {
+ if (!diff->fComparisonPath.startsWith(PATH_DIV_STR)) {
diff->fComparisonPath.prepend(relativePath);
}
int height = compute_image_height(diff->fBaseHeight, diff->fBaseWidth);
@@ -764,25 +772,25 @@
return 0;
}
- if (!baseDir.endsWith("/")) {
- baseDir.append("/");
+ if (!baseDir.endsWith(PATH_DIV_STR)) {
+ baseDir.append(PATH_DIV_STR);
}
- if (!comparisonDir.endsWith("/")) {
- comparisonDir.append("/");
+ if (!comparisonDir.endsWith(PATH_DIV_STR)) {
+ comparisonDir.append(PATH_DIV_STR);
}
- if (!outputDir.endsWith("/")) {
- outputDir.append("/");
+ if (!outputDir.endsWith(PATH_DIV_STR)) {
+ outputDir.append(PATH_DIV_STR);
}
if (analyzeChromium) {
- baseDir.append("webkit/");
+ baseDir.append("webkit" PATH_DIV_STR);
if (chromiumRelease) {
- baseDir.append("Release/");
+ baseDir.append("Release" PATH_DIV_STR);
}
if (chromiumDebug) {
- baseDir.append("Debug/");
+ baseDir.append("Debug" PATH_DIV_STR);
}
- baseDir.append("layout-test-results/");
+ baseDir.append("layout-test-results" PATH_DIV_STR);
analyze_chromium(diffProc, colorThreshold, &differences,
baseDir, outputDir, &summary);
} else {