protected function install($file, $inplace = false)
    {
        if (!$inplace) {
            $directory = $this->uploadZipToTemp($file);
        } else {
            $directory = $file;
        }
        $dir = $this->unzip($directory);
        $dirFull = $this->getArchiveDirectory($dir);
        $dirFull = str_replace(DIRECTORY_SEPARATOR, '/', $dirFull);
        $dirBase = substr(strrchr($dirFull, '/'), 1);
        if (file_exists($this->targetDirectory . '/' . $dirBase)) {
            throw new Exception(t('The directory %s already exists. Perhaps this item has already been installed.', $this->targetDirectory . '/' . $dirBase));
        } else {
            $this->f->copyAll($dirFull, $this->targetDirectory . '/' . $dirBase);
            if (!is_dir($this->targetDirectory . '/' . $dirBase)) {
                throw new Exception(t('Unable to copy directory %s to %s. Perhaps permissions are set incorrectly or the target directory does not exist.', $dirBase, $this->targetDirectory));
            }
        }

        return $dirBase;
    }