filebrowser/engine/FBFileOps.cpp
changeset 31 e7a04a6385be
parent 17 4f2773374eff
child 48 da3ec8478e66
equal deleted inserted replaced
30:d8e625c87f33 31:e7a04a6385be
   252                                 // if it is a directory entry, just create it based on the entry's attributes
   252                                 // if it is a directory entry, just create it based on the entry's attributes
   253                                 FileOpMkDirAll(fullTargetPath, entry.iAtt);
   253                                 FileOpMkDirAll(fullTargetPath, entry.iAtt);
   254                                 }
   254                                 }
   255                             else
   255                             else
   256                                 {
   256                                 {
       
   257                                 // ensure that root target folder exists
       
   258                                 BaflUtils::EnsurePathExistsL(iFs, iBuf2);
   257                                 // otherwise copy the file
   259                                 // otherwise copy the file
   258                                 FileOpCopy(fullSourcePath, fullTargetPath, iUint1);
   260                                 FileOpCopy(fullSourcePath, fullTargetPath, iUint1);
   259                                 }
   261                                 }
   260                             }
   262                             }
   261                             break;
   263                             break;
   329                 
   331                 
   330                 if (path.Length())
   332                 if (path.Length())
   331                     {
   333                     {
   332                     path.Append(entry.iName);
   334                     path.Append(entry.iName);
   333                     path.Append(_L("\\"));
   335                     path.Append(_L("\\"));
   334                     DoFindEntries(aFileName, path);
   336                     // test path.Left(iBuf2.Length()).Compare(iBuf2) - to prevent never ending recursive copy (in case of copy folder under itself)
       
   337                     if( !(iRecursiveState == EFileOpCopy && !path.Left(iBuf2.Length()).Compare(iBuf2)) )
       
   338                         {
       
   339                         DoFindEntries(aFileName, path);
       
   340                         }
   335                     }
   341                     }
   336                 }
   342                 }
   337             if ( iFileManObserverResult == MFileManObserver::ECancel )
   343             if ( iFileManObserverResult == MFileManObserver::ECancel )
   338                 {
   344                 {
   339                 break;
   345                 break;
   378     
   384     
   379         iBuf1.Copy(sourcePath);
   385         iBuf1.Copy(sourcePath);
   380         iBuf2.Copy(targetPath);
   386         iBuf2.Copy(targetPath);
   381         iUint1 = newSwitch;
   387         iUint1 = newSwitch;
   382         
   388         
   383         // create initial directory - if it does not succeed, do not even try to continue
   389         TRAP(err, DoFindEntries(_L("*"), sourcePath));              // entries under current directory entry
   384         err = FileOpMkDirAll(targetPath, aSourceEntry.iEntry.iAtt);
   390         if ( iFileManObserverResult != MFileManObserver::ECancel )
   385         
   391             {
   386         if (iOperationError == KErrNone)
   392             TRAP(err, DoFindEntriesRecursiveL(_L("*"), sourcePath));    // recursively under directories of current directory entry
   387             {
   393             }
   388             TRAP(err, DoFindEntries(_L("*"), sourcePath));              // entries under current directory entry
   394         // a path has a trailing backslash so it needs to be removed before the call
   389             if ( iFileManObserverResult != MFileManObserver::ECancel )
   395         err = FileOpAttribs(targetPath.Left(targetPath.Length()-1), aSourceEntry.iEntry.iAtt, 0, 0, 0);
   390                 {
       
   391                 TRAP(err, DoFindEntriesRecursiveL(_L("*"), sourcePath));    // recursively under directories of current directory entry
       
   392                 }
       
   393             }
       
   394         }
   396         }
   395 
   397 
   396     else if (aSourceEntry.iEntry.IsDir())
   398     else if (aSourceEntry.iEntry.IsDir())
   397         {
   399         {
   398         TFileName targetPath = aTargetFullName;
   400         TFileName targetPath = aTargetFullName;