From b0d408c5d3a2aae36f01f4fad745a7ab0279298e Mon Sep 17 00:00:00 2001 From: Anh Nhan Nguyen Date: Tue, 2 Apr 2013 09:01:33 -0700 Subject: [PATCH] Fix failing unit test `testParentEdgeCases` under Windows Summary: Noticed that this one was failing under Windows for the test cases where the root path (`/`) was supposed to be returned. Was returned Windows-style, made it return UNIX-style. All others work fine (return slashes as-is). Test Plan: `arc unit --everything` before and after this patch on Windows. Will try out Ubuntu in near future. Reviewers: epriestley, vrana Reviewed By: vrana CC: aran, Korvin, vrana Differential Revision: https://secure.phabricator.com/D5497 --- .../diffusion/query/pathid/DiffusionPathIDQuery.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/applications/diffusion/query/pathid/DiffusionPathIDQuery.php b/src/applications/diffusion/query/pathid/DiffusionPathIDQuery.php index bcb3c6f3f0..62e42e579c 100644 --- a/src/applications/diffusion/query/pathid/DiffusionPathIDQuery.php +++ b/src/applications/diffusion/query/pathid/DiffusionPathIDQuery.php @@ -63,7 +63,11 @@ final class DiffusionPathIDQuery { */ public static function getParentPath($path) { $path = self::normalizePath($path); - return dirname($path); + $path = dirname($path); + if (phutil_is_windows() && $path == '\\') { + $path = '/'; + } + return $path; }