Ticket #1508: filezilla3_beta2_transfer_empty_dir.patch

File filezilla3_beta2_transfer_empty_dir.patch, 4.0 KB (added by tommywu, 18 years ago)

let FZ3 create empty directory also

  • engine/ftpcontrolsocket.cpp

    diff -Nur src.orig/engine/ftpcontrolsocket.cpp src/engine/ftpcontrolsocket.cpp
    old new  
    15051505                // Be quiet
    15061506                wxLogNull nullLog;
    15071507
     1508                // twu2, create an empty directory only
     1509                if (pData->localFile.Last() == wxFileName::GetPathSeparator()) {
     1510                    // create dir
     1511                    wxFileName fn(pData->localFile);
     1512                    wxFileName::Mkdir(fn.GetPath(), 0777, wxPATH_MKDIR_FULL);
     1513                    ResetOperation(FZ_REPLY_OK);
     1514                    return FZ_REPLY_OK;
     1515                }
     1516
    15081517                wxFileOffset startOffset;
    15091518                if (pData->resume)
    15101519                {
     
    15701579            }
    15711580            else
    15721581            {
     1582                // twu2, create an empty directory only
     1583                if (pData->localFile.Last() == wxFileName::GetPathSeparator()) {
     1584                    // already created
     1585                    ResetOperation(FZ_REPLY_OK);
     1586                    return FZ_REPLY_OK;
     1587                }
     1588
    15731589                if (!pFile->Open(pData->localFile, wxFile::read))
    15741590                {
    15751591                    delete pFile;
  • engine/sftpcontrolsocket.cpp

    diff -Nur src.orig/engine/sftpcontrolsocket.cpp src/engine/sftpcontrolsocket.cpp
    old new  
    13921392            wxFileName fn(pData->localFile);
    13931393            wxFileName::Mkdir(fn.GetPath(), 0777, wxPATH_MKDIR_FULL);
    13941394        }
     1395        // twu2, create an empty directory only
     1396        if (pData->localFile.Last() == wxFileName::GetPathSeparator()) {
     1397            // already created
     1398            ResetOperation(FZ_REPLY_OK);
     1399            return FZ_REPLY_OK;
     1400        }
    13951401
    13961402        InitTransferStatus(pData->remoteFileSize, pData->resume ? pData->localFileSize : 0);
    13971403        cmd += _T("get ");
     
    14001406    }
    14011407    else
    14021408    {
     1409        // twu2, create an empty directory only
     1410        if (pData->localFile.Last() == wxFileName::GetPathSeparator()) {
     1411            // already created
     1412            ResetOperation(FZ_REPLY_OK);
     1413            return FZ_REPLY_OK;
     1414        }
    14031415        InitTransferStatus(pData->localFileSize, pData->resume ? pData->remoteFileSize : 0);
    14041416        cmd += _T("put ");
    14051417        cmd += QuoteFilename(pData->localFile) + _T(" ");
  • interface/QueueView.cpp

    diff -Nur src.orig/interface/QueueView.cpp src/interface/QueueView.cpp
    old new  
    9797                        m_pFolderItem->m_currentRemotePath = pair.remotePath;
    9898
    9999                        found = m_pFolderItem->m_pDir->GetFirst(&file);
     100                        // twu2, empty directory
     101                        if (!found) {
     102                            // add empty directory
     103                            wxFileName fn(pair.localPath);
     104                            t_newEntry entry;
     105                            entry.localFile = pair.localPath + wxFileName::GetPathSeparator();
     106                            entry.remoteFile = fn.GetName();
     107                            entry.remotePath = m_pFolderItem->m_currentRemotePath;
     108                            entry.size = 0;
     109
     110                            bool send = false;
     111                            m_sync.Enter();;
     112                            if (!m_entryList.size())
     113                                send = true;
     114                            m_entryList.push_back(entry);
     115                            m_sync.Leave();
     116
     117                            if (send)
     118                            {
     119                                wxCommandEvent evt(fzEVT_FOLDERTHREAD_FILES, wxID_ANY);
     120                                wxPostEvent(m_pOwner, evt);
     121                            }
     122                        }
    100123                    }
    101124                    else
    102125                        found = false;
  • interface/RemoteListView.cpp

    diff -Nur src.orig/interface/RemoteListView.cpp src/interface/RemoteListView.cpp
    old new  
    738738        {
    739739            wxFileName fn = wxFileName(m_pState->GetLocalDir(), _T(""));
    740740            fn.AppendDir(name);
     741            // twu2, add directory also
     742            m_pQueue->QueueFile(event.GetId() == XRCID("ID_ADDTOQUEUE"), true, fn.GetFullPath(), name, m_pDirectoryListing->path, *pServer, 0);
    741743            CServerPath remotePath = m_pDirectoryListing->path;
    742744            if (remotePath.AddSegment(name))
    743745            {
     
    955957            m_dirsToVisit.push_back(dirToVisit);
    956958            if (m_operationMode == recursive_delete)
    957959                m_dirsToDelete.push_front(dirToVisit);
     960            // twu2, add directory also
     961            if (m_operationMode == recursive_addtoqueue || m_operationMode == recursive_download)
     962                m_pQueue->QueueFile(m_operationMode == recursive_addtoqueue, true, fn.GetFullPath(), entry.name, m_pDirectoryListing->path, *pServer, 0);
    958963        }
    959964        else
    960965        {