Exemplo n.º 1
0
  @Override
  protected boolean doIsSameFile(FileObject destFile) throws FileSystemException {
    if (!FileObjectUtils.isInstanceOf(destFile, LocalFile.class)) {
      return false;
    }

    LocalFile destLocalFile = (LocalFile) FileObjectUtils.getAbstractFileObject(destFile);
    if (!exists() || !destLocalFile.exists()) {
      return false;
    }

    try {
      return file.getCanonicalPath().equals(destLocalFile.file.getCanonicalPath());
    } catch (IOException e) {
      throw new FileSystemException(e);
    }
  }
Exemplo n.º 2
0
  /** rename this file */
  @Override
  protected void doRename(final FileObject newfile) throws Exception {
    LocalFile newLocalFile = (LocalFile) FileObjectUtils.getAbstractFileObject(newfile);

    if (!file.renameTo(newLocalFile.getLocalFile())) {
      throw new FileSystemException(
          "vfs.provider.local/rename-file.error",
          new String[] {file.toString(), newfile.toString()});
    }
  }