//"D:\..\Exec\" BOOL MyTools::GetCurrentAppPath(CString& strAppPath) { TCHAR szFullExeName[MAX_PATH]; DWORD nResult = ::GetModuleFileName(NULL, szFullExeName, MAX_PATH); if (0 == nResult) { return FALSE; } CString strFullFileName(szFullExeName); UINT nIndex = strFullFileName.ReverseFind('\\'); strAppPath = strFullFileName.Left(nIndex+1); return TRUE; }
//Remove local client folder void CFileServer::RemoveDestFolder() { try { CDestFolderHelper folderHelper; folderHelper.SetDestFolder(m_strReceivePath); if (folderHelper.IsDestFolderExist()) { if (m_IsDestFolderPreviouslyExisted == false) { int nCount; BasicFileInfoList* pList = folderHelper.GetFileListInDestFolder(&nCount); if (pList == NULL) { ::RemoveDirectory(m_strReceivePath); } else { while (pList != NULL) { BasicFileInfoList* pNext = pList->pNext; CString strFullFileName(m_strReceivePath); CString strFileName(pList->fileInfo.FileName); strFullFileName += "\\" + strFileName; DeleteFile(strFullFileName); delete pList; pList = pNext; } ::RemoveDirectory(m_strReceivePath); } } } } catch(...) { if (gl_pLogger) gl_pLogger->log_info("CFileServer::RemoveDestFolder() unkown exception."); } }