Ejemplo n.º 1
0
int rho_sys_zip_files_with_path_array_ptr(const char* szZipFilePath, const char *base_path, const rho::Vector<rho::String>& arFiles, const char* psw)
{
	ZRESULT res;
	HZIP hz = 0;
	
#if defined(UNICODE) && defined(WIN32) && !defined(OS_WP8)
	hz = CreateZip( convertToStringW(szZipFilePath).c_str(), psw);
#else
	hz = CreateZip((TCHAR*)szZipFilePath, psw);
#endif
	
	if ( !hz )
		return -1;
	
	for ( int i = 0; i < (int)arFiles.size(); i++ )
	{
		rho::String filePath = arFiles.elementAt(i);
		bool isDir = CRhoFile::isDirectory(filePath.c_str());
		rho::String zipPath = base_path ? filePath.substr(strlen(base_path)) : filePath;
        if ( rho::String_startsWith( zipPath, "/") || rho::String_startsWith( zipPath, "\\") )
            zipPath = zipPath.substr(1);

#if defined(UNICODE) && defined(WIN32) && !defined(OS_WP8)
		if ( isDir )
			res = ZipAddFolder( hz, convertToStringW(zipPath).c_str(), convertToStringW(filePath).c_str() );
		else
			res = ZipAdd( hz, convertToStringW(zipPath).c_str(), convertToStringW(filePath).c_str() );
#else
		if ( isDir )
			res = ZipAddFolder( hz, (TCHAR*)zipPath.c_str(), (TCHAR*)filePath.c_str() );
		else
			res = ZipAdd(hz, (TCHAR*)zipPath.c_str(), (TCHAR*)filePath.c_str() );
#endif
		
		if (res != 0)
			LOG(ERROR) + "Zip file failed: " + res + "; " + filePath;
	}
	
	res = CloseZip(hz);
	
	return res;
}
Ejemplo n.º 2
0
 virtual void writeData( const rho::Vector<rho::String>& data, rho::apiGenerator::CMethodResult& oResult) {
     for(int i = 0; i < data.size(); i++){
         BluetoothThread::getInstance()->sendMessage(connected_device_name, QString::fromStdString(data.elementAt(i)));
     }
 }