Esempio n. 1
0
 unsigned operator()(const String& rel_path) const
 {
     unsigned res = 0;
     String path = CFilePath::join(m_root, rel_path);
     if(CRhoFile::isDirectory(path.c_str()))
     {
         res = iterateFolderTree(path, *this);
         unsigned res1 = CRhoFile::deleteEmptyFolder(path.c_str());
         if(res1 != 0) res = res1;
     }
     else
     {
         res = CRhoFile::deleteFile(path.c_str());
     }
     return res;
 }
Esempio n. 2
0
    unsigned operator()(const String& rel_path) const
    {
        unsigned res = 0;
        String path = CFilePath::join(m_root, rel_path);
        String dst_path = CFilePath::join(m_dst_root, rel_path);

        if(CRhoFile::isDirectory(path.c_str()))
        {
            if((res = CRhoFile::createFolder(dst_path.c_str())) == 0)
            {
                res = iterateFolderTree(path, *this);
            }
        }
        else
        {
            res = CRhoFile::copyFile(path.c_str(), dst_path.c_str());
        }
        return res;
    }
Esempio n. 3
0
/*static*/ unsigned int CRhoFile::moveFoldersContentToAnotherFolder(const char* szSrcFolderPath, const char* szDstFolderPath) 
{
#if defined(WINDOWS_PLATFORM)

    StringW strSrcW, strDstW;
    common::convertToStringW(szSrcFolderPath,strSrcW);
    common::convertToStringW(szDstFolderPath,strDstW);
    String_replace(strSrcW, L'/', L'\\' );
    String_replace(strDstW, L'/', L'\\' );

    return copyFolder(strSrcW, strDstW, true);
#elif defined (OS_ANDROID)

    return iterateFolderTree(String(szSrcFolderPath), MoveFileFunctor(szSrcFolderPath, szDstFolderPath));

#else
    rho_file_impl_move_folders_content_to_another_folder(szSrcFolderPath, szDstFolderPath);
    return 0;
#endif
}
Esempio n. 4
0
/*static*/ unsigned int CRhoFile::deleteFolder(const char* szFolderPath) 
{
#if !defined(OS_WP8)
#if defined(WINDOWS_PLATFORM)

	StringW  swPath;
    convertToStringW(szFolderPath, swPath);
	wchar_t* name = new wchar_t[ swPath.length() + 2];
    swprintf(name, L"%s%c", swPath.c_str(), '\0');
    translate_wchar(name, L'/', L'\\');

    SHFILEOPSTRUCTW fop = {0};

	fop.hwnd = NULL;
	fop.wFunc = FO_DELETE;		
        fop.pFrom = name;
	fop.pTo = NULL;
	fop.fFlags = FOF_SILENT | FOF_NOCONFIRMATION | FOF_NOCONFIRMMKDIR 
#if defined(OS_WINDOWS_DESKTOP) || defined(OS_PLATFORM_MOTCE)
                 | FOF_NOERRORUI
#endif        
        ;
        int result = SHFileOperationW(&fop);

    delete name;

    return result == 0 ? 0 : (unsigned int)-1;
#elif defined (OS_ANDROID)

    return iterateFolderTree(String(szFolderPath), RemoveFileFunctor(szFolderPath));

#else
    rho_file_impl_delete_folder(szFolderPath);
    return 0;
#endif
#else
	return 0;
#endif
}