/** * Returns a correct set of slashes for given $path. (\\ for Windows paths and / for other paths.) * * @param string $path Path to check * @return string Set of slashes ("\\" or "/") */ public static function correctSlashFor($path) { return Folder::isWindowsPath($path) ? '\\' : '/'; }
/** * testWindowsPath method * * @return void */ public function testWindowsPath() { $this->assertFalse(Folder::isWindowsPath('0:\\cake\\is\\awesome')); $this->assertTrue(Folder::isWindowsPath('C:\\cake\\is\\awesome')); $this->assertTrue(Folder::isWindowsPath('d:\\cake\\is\\awesome')); $this->assertTrue(Folder::isWindowsPath('\\\\vmware-host\\Shared Folders\\file')); }