function translate($path)
    {
        if(static::isWindowsOS())
        {
            if(preg_match('%^([A-Z]):(.*)%', $path, $matches))
            {
                // $path contains something like 'C:' at the start,
                // so it's an absolute path from the root.

                $drive = $matches[1];
                $file = $matches[2];
                $unixFile = str_replace('\\', '/', $file);

                if(static::isWindowsMsys())
                {
                    $path = '/' . strtolower($drive) . $unixFile;
                }
                else if(static::isWindowsCygwin())
                {
                    $path = '/cygdrive/' . strtolower($drive) . $unixFile;
                }
            }
            else
            {
                // $path does not look like 'C:' so we assume it to be relative
                if(static::isWindowsMsys() || static::isWindowsCygwin())
                    $path = str_replace('\\', '/', $path);;
            }
        }

        return $path;
    }