Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15195474
D13030.id31583.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D13030.id31583.diff
View Options
diff --git a/src/filesystem/Filesystem.php b/src/filesystem/Filesystem.php
--- a/src/filesystem/Filesystem.php
+++ b/src/filesystem/Filesystem.php
@@ -772,6 +772,20 @@
/**
+ * Checks if a path is specified as an absolute path.
+ *
+ * @param string
+ * @return bool
+ */
+ public static function isAbsolutePath($path) {
+ if (phutil_is_windows()) {
+ return (bool)preg_match('/^[A-Za-z]+:/', $path);
+ } else {
+ return !strncmp($path, DIRECTORY_SEPARATOR, 1);
+ }
+ }
+
+ /**
* Canonicalize a path by resolving it relative to some directory (by
* default PWD), following parent symlinks and removing artifacts. If the
* path is itself a symlink it is left unresolved.
@@ -782,11 +796,7 @@
* @task path
*/
public static function resolvePath($path, $relative_to = null) {
- if (phutil_is_windows()) {
- $is_absolute = preg_match('/^[A-Za-z]+:/', $path);
- } else {
- $is_absolute = !strncmp($path, DIRECTORY_SEPARATOR, 1);
- }
+ $is_absolute = self::isAbsolutePath($path);
if (!$is_absolute) {
if (!$relative_to) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Feb 23, 1:41 PM (12 h, 2 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7186472
Default Alt Text
D13030.id31583.diff (1 KB)
Attached To
Mode
D13030: Add an isAbsolutePath method
Attached
Detach File
Event Timeline
Log In to Comment