/** * @param File $file * * @return string */ public function getFullPath(File $file) { return $this->rootPath . ltrim($file->getPath(), '.') . '/'; }
public function moveFile(File $file, $destination) { global $_ARRAYLANG; if (!empty($destination)) { if ($file->getExtension() == '' && is_dir($this->rootPath . ltrim($file->getPath(), '.') . '/' . $file->getName())) { $fileName = $this->rootPath . ltrim($file->getPath(), '.') . '/' . $file->getName(); $destinationFileName = $this->rootPath . ltrim($file->getPath(), '.') . '/' . $destination; } else { $fileName = $this->rootPath . ltrim($file->getPath(), '.') . '/' . $file->getName() . '.' . $file->getExtension(); $destinationFileName = $this->rootPath . ltrim($file->getPath(), '.') . '/' . $destination . '.' . $file->getExtension(); } if ($fileName == $destinationFileName) { return sprintf($_ARRAYLANG['TXT_FILEBROWSER_FILE_SUCCESSFULLY_RENAMED'], $file->getName()); } if (!\Cx\Lib\FileSystem\FileSystem::move($fileName, $destinationFileName, false)) { return sprintf($_ARRAYLANG['TXT_FILEBROWSER_FILE_UNSUCCESSFULLY_RENAMED'], $file->getName()); } return sprintf($_ARRAYLANG['TXT_FILEBROWSER_FILE_SUCCESSFULLY_RENAMED'], $file->getName()); } else { return sprintf($_ARRAYLANG['TXT_FILEBROWSER_FILE_UNSUCCESSFULLY_RENAMED'], $file->getName()); } }