Пример #1
0
bool FileSystemRedirect::rename(const Path& a,const Path& b)
{
   Path na = _merge(a);
   Path nb = _merge(b);
   FileSystemRef fsa = mMFS->getFileSystem(na);
   FileSystemRef fsb = mMFS->getFileSystem(nb);
   if (fsa.getPointer() == fsb.getPointer())
      return fsa->rename(na,nb);
   return false;
}
Пример #2
0
bool MountSystem::rename(const Path& from,const Path& to)
{
   // Will only rename files on the same filesystem
   Path pa = _normalize(from);
   Path pb = _normalize(to);
   FileSystemRef fsa = _getFileSystemFromList(pa);
   FileSystemRef fsb = _getFileSystemFromList(pb);
   if (!fsa || !fsb)
      return false;
   if (fsa.getPointer() != fsb.getPointer())
   {
      _log(String::ToString("Cannot rename path %s to a different filesystem", from.getFullPath().c_str()));
      return false;
   }
   if (fsa->isReadOnly() || fsb->isReadOnly())
   {
      _log(String::ToString("Cannot rename path %s; source or target filesystem is read-only", from.getFullPath().c_str()));
      return false;
   }

   return fsa->rename(pa,pb);
}