VError PathBuffer::ToPath(VFilePath* outPath) const { if(outPath==NULL) return VE_INVALID_PARAMETER; VString tmpPath; VError verr=ToPath(&tmpPath); if(verr!=VE_OK) return verr; outPath->FromFullPath(tmpPath, FPS_POSIX); //Do we really need a 'full' path here ? return (outPath->IsValid()==true) ? VE_OK : VE_INVALID_PARAMETER; }
//=========================================================================== void CSMLoginScene::OnTimer( OBJID idTag ) { static bool bFirst = true; if (bFirst) { LOGD("Entry First OnTimer"); //idTag = TAG_TIMER_UPDATE; bFirst = false; } if ( idTag == TAG_TIMER_UPDATE ) { if ( !rename( m_strSavePath.c_str(), m_strSavePath.c_str() ) ) { if ( remove( m_strSavePath.c_str() ) ) { m_pTimer->KillTimer(this, TAG_TIMER_UPDATE); return; } } FromUrl(m_strUpdateURL.c_str()); ToPath(m_strSavePath.c_str()); Download(); m_pTimer->KillTimer(this, TAG_TIMER_UPDATE); } else if ( idTag == TAG_TIMER_DOWNLOAD_SUCCESS ) { m_pTimer->KillTimer(this, TAG_TIMER_DOWNLOAD_SUCCESS); LOGD("Entry TAG_TIMER_DOWNLOAD_SUCCESS process."); UnZipFile( m_strSavePath.c_str(), m_strCachePath.c_str()); } else if ( idTag == TAG_TIMER_UNZIP_SUCCESS ) { m_pTimer->KillTimer(this, TAG_TIMER_UNZIP_SUCCESS); if ( remove(m_strSavePath.c_str()) ) { NDLog("delete:%s failed",m_strSavePath.c_str()); //return; } std::string szListFile = NDPath::GetCashesPath() + SZ_DEL_FILE; DeleteFileFromFile( szListFile ); if(kDeqUpdateUrl.size() > 0) { kDeqUpdateUrl.pop_front(); } PackageCount++; //查找下载队列 if (kDeqUpdateUrl.size() > 0) { //定义保存路径 m_strUpdateURL = *kDeqUpdateUrl.begin(); //m_savePath = [[NSString stringWithFormat:@"%s/update%d.zip", m_cachPath.c_str(), PackageCount] UTF8String]; m_pTimer->SetTimer( this, TAG_TIMER_UPDATE, 0.5f ); StartDownload(); } else { //跳转到启动界面 StartEntry(); } } else if ( TAG_TIMER_CHECK_WIFI == idTag ) { //如果检测没开启WIFI则不断检测// if ( NDBeforeGameMgrObj.isWifiNetWork() ) { m_pTimer->KillTimer( this, TAG_TIMER_CHECK_WIFI ); CloseConfirmDlg(); StartUpdate(); } } else if ( TAG_TIMER_CHECK_UPDATE == idTag ) { m_pTimer->KillTimer(this, TAG_TIMER_CHECK_UPDATE); ShowUpdateOff(); } else if ( TAG_TIMER_CHECK_COPY == idTag ) { int copyStatus = NDBeforeGameMgr::GetCopyStatus(); switch (copyStatus) { case -1: m_pTimer->KillTimer( this, TAG_TIMER_CHECK_COPY ); //NSLog( @"Copy files error!" ); exit(0); break; case 0: break; case 1: m_pTimer->KillTimer( this, TAG_TIMER_CHECK_COPY ); NDBeforeGameMgrObj.doNDSdkLogin(); ShowWaitingAni(); break; default: break; } } else if ( TAG_TIMER_FIRST_RUN == idTag ) { LOGD("Entry TAG_TIMER_FIRST_RUN == idTag"); m_pTimer->KillTimer( this, TAG_TIMER_FIRST_RUN ); CreateUpdateUILayer(); #if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) CCLog( "@@login02: to call OnEvent_LoginOKNormal()\r\n" ); m_iAccountID = NDBeforeGameMgrObj.GetCurrentUser(); OnEvent_LoginOKNormal(m_iAccountID); #else #ifdef USE_MGSDK NDUIImage * pImage = (NDUIImage *)m_pLayerUpdate->GetChild( TAG_CTRL_PIC_BG); if ( pImage ) { NDPicture * pPicture = new NDPicture; pPicture->Initialization( NDPath::GetUIImgPath( SZ_MOBAGE_BG_PNG_PATH ).c_str() ); pImage->SetPicture( pPicture, true ); } #endif #if CACHE_MODE == 1 if ( NDBeforeGameMgrObj.CheckFirstTimeRuning() ) { if ( m_pLabelPromtp ) { m_pLabelPromtp->SetText( NDCommonCString2(SZ_FIRST_INSTALL).c_str() ); m_pLabelPromtp->SetVisible( true ); ShowWaitingAni(); #ifdef USE_MGSDK m_pLabelPromtp->SetVisible( false );//Mobage的版本暂将文字绘在背景图上 #endif } m_pTimer->SetTimer( this, TAG_TIMER_CHECK_COPY, 0.5f ); } else #endif { NDBeforeGameMgrObj.doNDSdkLogin(); ShowWaitingAni(); } #endif //CreateUpdateUILayer(); //NDBeforeGameMgrObj.CheckClientVersion(SZ_UPDATE_URL); } else if ( TAG_TIMER_LOAD_RES_OK == idTag ) { m_pTimer->KillTimer( this, TAG_TIMER_LOAD_RES_OK ); CloseWaitingAni(); CloseUpdateUILayer(); #if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) //if ( m_iAccountID == 0 ) m_iAccountID = ScriptMgrObj.excuteLuaFuncRetN( "GetAccountID", "Login_ServerUI" ); #endif #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) m_iAccountID = NDBeforeGameMgrObj.GetCurrentUser(); #endif ScriptMgrObj.excuteLuaFunc( "ShowUI", "Entry", m_iAccountID ); // ScriptMgrObj.excuteLuaFunc("ProecssLocalNotification", "MsgLoginSuc"); } }