From 78ee216ea240372a146e64367c7769d8a611e3f7 Mon Sep 17 00:00:00 2001 From: Antonio Carlos Ribeiro Date: Tue, 9 Dec 2014 17:31:15 -0200 Subject: [PATCH] Add support for home dir as tilde --- CodeSniffer.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CodeSniffer.php b/CodeSniffer.php index 2aa14f5c3f..64ae6185f5 100644 --- a/CodeSniffer.php +++ b/CodeSniffer.php @@ -2169,6 +2169,12 @@ public static function isInstalledStandard($standard) */ public static function getInstalledStandardPath($standard) { + if (substr($standard, 0, 2) == '~/' && is_dir($fromHome = getenv('HOME') . substr($standard, 1))) { + if (is_file($path = self::realpath($fromHome.DIRECTORY_SEPARATOR.'ruleset.xml'))) { + return $path; + } + $standard = $fromHome; + } $installedPaths = self::getInstalledStandardPaths(); foreach ($installedPaths as $installedPath) { $standardPath = $installedPath.DIRECTORY_SEPARATOR.$standard;