private function createPath($share, $directory = '')
    {
        if (empty($directory) && ($directory != '0')) {
            return empty($share) ? '/' : $share;
        }
        $encodedFile = urlencode($directory);
        // Unencode the forward slashes to match what the server expects.
        $encodedFile = str_replace('%2F', '/', $encodedFile);
        // Unencode the backward slashes to match what the server expects.
        $encodedFile = str_replace('%5C', '/', $encodedFile);
        // Re-encode the spaces (encoded as space) to the % encoding.
        $encodedFile = str_replace('+', '%20', $encodedFile);
        // Empty share means accessing default share
        if (empty($share)) {
            return $encodedFile;
        }
        return '/' . $share . '/' . $encodedFile;
    }