这篇教程C++ GetPath函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GetPath函数的典型用法代码示例。如果您正苦于以下问题:C++ GetPath函数的具体用法?C++ GetPath怎么用?C++ GetPath使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GetPath函数的24个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: GetPathNS_IMETHODIMPnsLocalFile::GetRelativeDescriptor(nsIFile* aFromFile, nsACString& aResult){ if (NS_WARN_IF(!aFromFile)) { return NS_ERROR_INVALID_ARG; } // // aResult will be UTF-8 encoded // nsresult rv; aResult.Truncate(0); nsAutoString thisPath, fromPath; nsAutoTArray<char16_t*, 32> thisNodes; nsAutoTArray<char16_t*, 32> fromNodes; rv = GetPath(thisPath); if (NS_FAILED(rv)) { return rv; } rv = aFromFile->GetPath(fromPath); if (NS_FAILED(rv)) { return rv; } // get raw pointer to mutable string buffer char16_t* thisPathPtr; thisPath.BeginWriting(thisPathPtr); char16_t* fromPathPtr; fromPath.BeginWriting(fromPathPtr); SplitPath(thisPathPtr, thisNodes); SplitPath(fromPathPtr, fromNodes); size_t nodeIndex; for (nodeIndex = 0; nodeIndex < thisNodes.Length() && nodeIndex < fromNodes.Length(); ++nodeIndex) {#ifdef XP_WIN if (_wcsicmp(char16ptr_t(thisNodes[nodeIndex]), char16ptr_t(fromNodes[nodeIndex]))) { break; }#else if (nsCRT::strcmp(thisNodes[nodeIndex], fromNodes[nodeIndex])) { break; }#endif } size_t branchIndex = nodeIndex; for (nodeIndex = branchIndex; nodeIndex < fromNodes.Length(); ++nodeIndex) { aResult.AppendLiteral("../"); } for (nodeIndex = branchIndex; nodeIndex < thisNodes.Length(); ++nodeIndex) { NS_ConvertUTF16toUTF8 nodeStr(thisNodes[nodeIndex]); aResult.Append(nodeStr); if (nodeIndex + 1 < thisNodes.Length()) { aResult.Append('/'); } } return NS_OK;}
开发者ID:Nazi-Nigger,项目名称:gecko-dev,代码行数:66,
示例2: OnOkUIvoid PHPDebugStartDlg::OnOkUI(wxUpdateUIEvent& event) { event.Enable(!GetPath().IsEmpty()); }
开发者ID:05storm26,项目名称:codelite,代码行数:1,
示例3: switchvoid CVideoInfoTag::ToSortable(SortItem& sortable, Field field) const{ switch (field) { case FieldDirector: sortable[FieldDirector] = m_director; break; case FieldWriter: sortable[FieldWriter] = m_writingCredits; break; case FieldGenre: sortable[FieldGenre] = m_genre; break; case FieldCountry: sortable[FieldCountry] = m_country; break; case FieldTagline: sortable[FieldTagline] = m_strTagLine; break; case FieldPlotOutline: sortable[FieldPlotOutline] = m_strPlotOutline; break; case FieldPlot: sortable[FieldPlot] = m_strPlot; break; case FieldTitle: { // make sure not to overwrite an existing title with an empty one std::string title = m_strTitle; if (!title.empty() || sortable.find(FieldTitle) == sortable.end()) sortable[FieldTitle] = title; break; } case FieldVotes: sortable[FieldVotes] = m_strVotes; break; case FieldStudio: sortable[FieldStudio] = m_studio; break; case FieldTrailer: sortable[FieldTrailer] = m_strTrailer; break; case FieldSet: sortable[FieldSet] = m_strSet; break; case FieldTime: sortable[FieldTime] = GetDuration(); break; case FieldFilename: sortable[FieldFilename] = m_strFile; break; case FieldMPAA: sortable[FieldMPAA] = m_strMPAARating; break; case FieldPath: { // make sure not to overwrite an existing path with an empty one std::string path = GetPath(); if (!path.empty() || sortable.find(FieldPath) == sortable.end()) sortable[FieldPath] = path; break; } case FieldSortTitle: sortable[FieldSortTitle] = m_strSortTitle; break; case FieldTvShowStatus: sortable[FieldTvShowStatus] = m_strStatus; break; case FieldProductionCode: sortable[FieldProductionCode] = m_strProductionCode; break; case FieldAirDate: sortable[FieldAirDate] = m_firstAired.IsValid() ? m_firstAired.GetAsDBDate() : (m_premiered.IsValid() ? m_premiered.GetAsDBDate() : StringUtils::Empty); break; case FieldTvShowTitle: sortable[FieldTvShowTitle] = m_strShowTitle; break; case FieldAlbum: sortable[FieldAlbum] = m_strAlbum; break; case FieldArtist: sortable[FieldArtist] = m_artist; break; case FieldPlaycount: sortable[FieldPlaycount] = m_playCount; break; case FieldLastPlayed: sortable[FieldLastPlayed] = m_lastPlayed.IsValid() ? m_lastPlayed.GetAsDBDateTime() : StringUtils::Empty; break; case FieldTop250: sortable[FieldTop250] = m_iTop250; break; case FieldYear: sortable[FieldYear] = m_iYear; break; case FieldSeason: sortable[FieldSeason] = m_iSeason; break; case FieldEpisodeNumber: sortable[FieldEpisodeNumber] = m_iEpisode; break; case FieldNumberOfEpisodes: sortable[FieldNumberOfEpisodes] = m_iEpisode; break; case FieldNumberOfWatchedEpisodes: sortable[FieldNumberOfWatchedEpisodes] = m_iEpisode; break; case FieldEpisodeNumberSpecialSort: sortable[FieldEpisodeNumberSpecialSort] = m_iSpecialSortEpisode; break; case FieldSeasonSpecialSort: sortable[FieldSeasonSpecialSort] = m_iSpecialSortSeason; break; case FieldRating: sortable[FieldRating] = m_fRating; break; case FieldUserRating: sortable[FieldUserRating] = m_iUserRating; break; case FieldId: sortable[FieldId] = m_iDbId; break; case FieldTrackNumber: sortable[FieldTrackNumber] = m_iTrack; break; case FieldTag: sortable[FieldTag] = m_tags; break; case FieldVideoResolution: sortable[FieldVideoResolution] = m_streamDetails.GetVideoHeight(); break; case FieldVideoAspectRatio: sortable[FieldVideoAspectRatio] = m_streamDetails.GetVideoAspect(); break; case FieldVideoCodec: sortable[FieldVideoCodec] = m_streamDetails.GetVideoCodec(); break; case FieldStereoMode: sortable[FieldStereoMode] = m_streamDetails.GetStereoMode(); break; case FieldAudioChannels: sortable[FieldAudioChannels] = m_streamDetails.GetAudioChannels(); break; case FieldAudioCodec: sortable[FieldAudioCodec] = m_streamDetails.GetAudioCodec(); break; case FieldAudioLanguage: sortable[FieldAudioLanguage] = m_streamDetails.GetAudioLanguage(); break; case FieldSubtitleLanguage: sortable[FieldSubtitleLanguage] = m_streamDetails.GetSubtitleLanguage(); break; case FieldInProgress: sortable[FieldInProgress] = m_resumePoint.IsPartWay(); break; case FieldDateAdded: sortable[FieldDateAdded] = m_dateAdded.IsValid() ? m_dateAdded.GetAsDBDateTime() : StringUtils::Empty; break; case FieldMediaType: sortable[FieldMediaType] = m_type; break; default: break; }}
开发者ID:KeTao,项目名称:kodi-cmake,代码行数:74,
示例4: SetNamevoid FarFileName::SetName (const FarFileName& name){ *this = FarFileName::MakeName (GetPath(), name.GetName());}
开发者ID:Maximus5,项目名称:evil-programmers,代码行数:4,
示例5: Init int Init(const char *pApplicationName, int StorageType, int NumArgs, const char **ppArguments) { // get userdir fs_storage_path(pApplicationName, m_aUserdir, sizeof(m_aUserdir)); // get datadir FindDatadir(ppArguments[0]); // get currentdir if(!fs_getcwd(m_aCurrentdir, sizeof(m_aCurrentdir))) m_aCurrentdir[0] = 0; // load paths from storage.cfg LoadPaths(ppArguments[0]); if(!m_NumPaths) { dbg_msg("storage", "using standard paths"); AddDefaultPaths(); } // add save directories if(StorageType != STORAGETYPE_BASIC) { if(m_NumPaths && (!m_aaStoragePaths[TYPE_SAVE][0] || !fs_makedir(m_aaStoragePaths[TYPE_SAVE]))) { char aPath[MAX_PATH_LENGTH]; if(StorageType == STORAGETYPE_CLIENT) { fs_makedir(GetPath(TYPE_SAVE, "screenshots", aPath, sizeof(aPath))); fs_makedir(GetPath(TYPE_SAVE, "screenshots/auto", aPath, sizeof(aPath))); fs_makedir(GetPath(TYPE_SAVE, "maps", aPath, sizeof(aPath))); fs_makedir(GetPath(TYPE_SAVE, "downloadedmaps", aPath, sizeof(aPath))); fs_makedir(GetPath(TYPE_SAVE, "downloadedmods", aPath, sizeof(aPath))); fs_makedir(GetPath(TYPE_SAVE, "skins", aPath, sizeof(aPath))); } fs_makedir(GetPath(TYPE_SAVE, "mods", aPath, sizeof(aPath))); fs_makedir(GetPath(TYPE_SAVE, "dumps", aPath, sizeof(aPath))); fs_makedir(GetPath(TYPE_SAVE, "demos", aPath, sizeof(aPath))); fs_makedir(GetPath(TYPE_SAVE, "demos/auto", aPath, sizeof(aPath))); fs_makedir(GetPath(TYPE_SAVE, "configs", aPath, sizeof(aPath))); } else { dbg_msg("storage", "unable to create save directory"); return 1; } } return m_NumPaths ? 0 : 1; }
开发者ID:killaTW,项目名称:teeworlds,代码行数:51,
示例6: ok_path/* Helper function to verify that the current path in the given DC matches the expected path. * * We use a "smart" matching algorithm that allows us to detect partial improvements * in conformance. Specifically, two running indices are kept, one through the actual * path and one through the expected path. The actual path index increases unless there is * no match and the todo field of the appropriate path_test_t element is 2. Similarly, * if the wine_entries_preceding field of the appropriate path_test_t element is non-zero, * the expected path index does not increase for that many elements as long as there * is no match. This allows us to todo_wine extra path elements that are present only * on wine but not on native and vice versa. * * Note that if expected_size is zero and the WINETEST_DEBUG environment variable is * greater than 2, the trace() output is a C path_test_t array structure, useful for making * new tests that use this function. */static void ok_path(HDC hdc, const char *path_name, const path_test_t *expected, int expected_size, BOOL todo_size){ static const char *type_string[8] = { "Unknown (0)", "PT_CLOSEFIGURE", "PT_LINETO", "PT_LINETO | PT_CLOSEFIGURE", "PT_BEZIERTO", "PT_BEZIERTO | PT_CLOSEFIGURE", "PT_MOVETO", "PT_MOVETO | PT_CLOSEFIGURE"}; POINT *pnt = NULL; BYTE *types = NULL; int size, numskip, idx = 0, eidx = 0; /* Get the path */ assert(hdc != 0); size = GetPath(hdc, NULL, NULL, 0); ok(size > 0, "GetPath returned size %d, last error %d/n", size, GetLastError()); if (size <= 0) { skip("Cannot perform path comparisons due to failure to retrieve path./n"); return; } pnt = HeapAlloc(GetProcessHeap(), 0, size*sizeof(POINT)); assert(pnt != 0); types = HeapAlloc(GetProcessHeap(), 0, size*sizeof(BYTE)); assert(types != 0); size = GetPath(hdc, pnt, types, size); assert(size > 0); if (todo_size) todo_wine ok(size == expected_size, "Path size %d does not match expected size %d/n", size, expected_size); else ok(size == expected_size, "Path size %d does not match expected size %d/n", size, expected_size); if (winetest_debug > 2) trace("static const path_test_t %s[] = {/n", path_name); numskip = expected_size ? expected[eidx].wine_only_entries_preceding : 0; while (idx < size && eidx < expected_size) { /* We allow a few pixels fudge in matching X and Y coordinates to account for imprecision in * floating point to integer conversion */ BOOL match = (types[idx] == expected[eidx].type) && (pnt[idx].x >= expected[eidx].x-2 && pnt[idx].x <= expected[eidx].x+2) && (pnt[idx].y >= expected[eidx].y-2 && pnt[idx].y <= expected[eidx].y+2); if (expected[eidx].todo || numskip) todo_wine ok(match, "Expected #%d: %s (%d,%d) but got %s (%d,%d)/n", eidx, type_string[expected[eidx].type], expected[eidx].x, expected[eidx].y, type_string[types[idx]], pnt[idx].x, pnt[idx].y); else ok(match, "Expected #%d: %s (%d,%d) but got %s (%d,%d)/n", eidx, type_string[expected[eidx].type], expected[eidx].x, expected[eidx].y, type_string[types[idx]], pnt[idx].x, pnt[idx].y); if (match || expected[eidx].todo != 2) { if (winetest_debug > 2) trace(" {%d, %d, %s, 0, 0}%s /* %d *//n", pnt[idx].x, pnt[idx].y, type_string[types[idx]], idx < size-1 ? "," : "};", idx); idx++; } if (match || !numskip--) numskip = expected[++eidx].wine_only_entries_preceding; } /* If we are debugging and the actual path is longer than the expected path, make * sure to display the entire path */ if (winetest_debug > 2 && idx < size) for (; idx < size; idx++) trace(" {%d, %d, %s, 0, 0}%s /* %d *//n", pnt[idx].x, pnt[idx].y, type_string[types[idx]], idx < size-1 ? "," : "};", idx); HeapFree(GetProcessHeap(), 0, types); HeapFree(GetProcessHeap(), 0, pnt);}
开发者ID:mikekap,项目名称:wine,代码行数:88,
示例7: GetDir ERMsg CUIEnvCanPrcpRadar::Execute(CCallback& callback) { ERMsg msg; string workingDir = GetDir(WORKING_DIR); CInternetSessionPtr pSession; CHttpConnectionPtr pConnection; msg = GetHttpConnection(SERVER_NAME, pConnection, pSession); if (!msg) return msg; callback.AddMessage(GetString(IDS_UPDATE_DIR)); callback.AddMessage(workingDir, 1); callback.AddMessage(GetString(IDS_UPDATE_FROM)); callback.AddMessage(SERVER_NAME, 1); callback.AddMessage(""); string type = as<size_t>(TYPE) == TYPE_06HOURS ? "06" : "24"; string path = SERVER_PATH + type + "/*.grib2"; CFileInfoVector fileList; msg = UtilWWW::FindFiles(pConnection, path, fileList); callback.AddMessage("Number of images found: " + ToString(fileList.size())); //keep only 10km grid for (CFileInfoVector::const_iterator it = fileList.begin(); it != fileList.end();) { // string fileTitle = GetFileTitle(it->m_filePath);// if (Find(fileTitle, "ps10km")) // { // it = fileList.erase(it);// } // else // { string fileName = GetFileName(it->m_filePath); string filePath = GetOutputFilePath(fileName); if (!NeedDownload(*it, filePath)) it = fileList.erase(it); else it++; //} msg += callback.StepIt(0); } //remove up to date file //for(int i=fileList.size()-1; i>=0; i--) //{ // string fileName = GetFileName(fileList[i].m_filePath); // string filePath = GetOutputFilePath(fileName); // if( !NeedDownload(fileList[i], filePath) ) // fileList.erase(fileList.begin() + i); // msg += callback.StepIt(0); //} callback.AddMessage("Number of images to download after clearing: " + ToString(fileList.size())); callback.PushTask("Download precipitation images + (" + ToString(fileList.size() )+ ")", fileList.size()); //callback.SetNbStep(fileList.size()); int nbDownload = 0; for (size_t i = 0; i < fileList.size() && msg; i++) { string filePath = GetOutputFilePath(GetFileName(fileList[i].m_filePath)); CreateMultipleDir(GetPath(filePath)); msg = UtilWWW::CopyFile(pConnection, fileList[i].m_filePath, filePath, INTERNET_FLAG_TRANSFER_BINARY | INTERNET_FLAG_RELOAD | INTERNET_FLAG_EXISTING_CONNECT | INTERNET_FLAG_DONT_CACHE); if (msg) nbDownload++; msg += callback.StepIt(); } pConnection->Close(); pSession->Close(); callback.AddMessage("Number of images downloaded: " + ToString(nbDownload)); callback.PopTask(); return msg; }
开发者ID:RNCan,项目名称:WeatherBasedSimulationFramework,代码行数:87,
示例8: D3DXLoadMeshHierarchyFromXA//-----------------------------------------------------------------------------// The mesh class constructor.//-----------------------------------------------------------------------------Mesh::Mesh( char *name, char *path ) : Resource< Mesh >( name, path ){ // Create the list of reference points. m_frames = new LinkedList< Frame >; m_refPoints = new LinkedList< Frame >; // Load the mesh's frame hierarchy. AllocateHierarchy ah; D3DXLoadMeshHierarchyFromXA( GetFilename(), D3DXMESH_MANAGED, g_engine->GetDevice(), &ah, NULL, (D3DXFRAME**)&m_firstFrame, &m_animationController ); // Disable all the animation tracks initially. if( m_animationController != NULL ) for( unsigned long t = 0; t < m_animationController->GetMaxNumTracks(); ++t ) m_animationController->SetTrackEnable( t, false ); // Invalidate the bone transformation matrices array. m_boneMatrices = NULL; m_totalBoneMatrices = 0; // Prepare the frame hierarchy. PrepareFrame( m_firstFrame ); // Allocate memory for the bone matrices. m_boneMatrices = new D3DXMATRIX[m_totalBoneMatrices]; // Create a static (non-animated) version of the mesh. m_staticMesh = new MeshContainer; ZeroMemory( m_staticMesh, sizeof( MeshContainer ) ); // Load the mesh. ID3DXBuffer *materialBuffer, *adjacencyBuffer; D3DXLoadMeshFromXA( GetFilename(), D3DXMESH_MANAGED, g_engine->GetDevice(), &adjacencyBuffer, &materialBuffer, NULL, &m_staticMesh->NumMaterials, &m_staticMesh->originalMesh ); // Optimise the mesh for better rendering performance. m_staticMesh->originalMesh->OptimizeInplace( D3DXMESHOPT_COMPACT | D3DXMESHOPT_ATTRSORT | D3DXMESHOPT_VERTEXCACHE, (DWORD*)adjacencyBuffer->GetBufferPointer(), NULL, NULL, NULL ); // Finished with the adjacency buffer, so destroy it. SAFE_RELEASE( adjacencyBuffer ); // Check if the mesh has any materials. if( m_staticMesh->NumMaterials > 0 ) { // Create the array of materials. m_staticMesh->materials = new Material*[m_staticMesh->NumMaterials]; // Get the list of materials from the material buffer. D3DXMATERIAL *materials = (D3DXMATERIAL*)materialBuffer->GetBufferPointer(); // Load each material into the array via the material manager. for( unsigned long m = 0; m < m_staticMesh->NumMaterials; m++ ) { // Ensure the material has a texture. if( materials[m].pTextureFilename ) { // Get the name of the material's script and load it. char *name = new char[strlen( materials[m].pTextureFilename ) + 5]; sprintf( name, "%s.txt", materials[m].pTextureFilename ); m_staticMesh->materials[m] = g_engine->GetMaterialManager()->Add( name, GetPath() ); SAFE_DELETE_ARRAY( name ); } else m_staticMesh->materials[m] = NULL; } } // Create the bounding volume around the mesh. BoundingVolumeFromMesh( m_staticMesh->originalMesh ); // Destroy the material buffer. SAFE_RELEASE( materialBuffer ); // Create a vertex array and an array of indices into the vertex array. m_vertices = new Vertex[m_staticMesh->originalMesh->GetNumVertices()]; m_indices = new unsigned short[m_staticMesh->originalMesh->GetNumFaces() * 3]; // Use the arrays to store a local copy of the static mesh's vertices and // indices so that they can be used by the scene manager on the fly. Vertex* verticesPtr; m_staticMesh->originalMesh->LockVertexBuffer( 0, (void**)&verticesPtr ); unsigned short *indicesPtr; m_staticMesh->originalMesh->LockIndexBuffer( 0, (void**)&indicesPtr ); memcpy( m_vertices, verticesPtr, VERTEX_FVF_SIZE * m_staticMesh->originalMesh->GetNumVertices() ); memcpy( m_indices, indicesPtr, sizeof( unsigned short ) * m_staticMesh->originalMesh->GetNumFaces() * 3 ); m_staticMesh->originalMesh->UnlockVertexBuffer(); m_staticMesh->originalMesh->UnlockIndexBuffer();}
开发者ID:BornHunter,项目名称:CGSF,代码行数:91,
示例9: sprintf//-----------------------------------------------------------------------------// Prepares the given frame.//-----------------------------------------------------------------------------void Mesh::PrepareFrame( Frame *frame ){ m_frames->Add( frame ); // Check if this frame is actually a reference point. if( strncmp( "rp_", frame->Name, 3 ) == 0 ) m_refPoints->Add( frame ); // Set the initial final transformation. frame->finalTransformationMatrix = frame->TransformationMatrix; // Prepare the frame's mesh container, if it has one. if( frame->pMeshContainer != NULL ) { MeshContainer *meshContainer = (MeshContainer*)frame->pMeshContainer; // Check if this mesh is a skinned mesh. if( meshContainer->pSkinInfo != NULL ) { // Create the array of bone matrix pointers. meshContainer->boneMatrixPointers = new D3DXMATRIX*[meshContainer->pSkinInfo->GetNumBones()]; // Set up the pointers to the mesh's bone transformation matrices. for( unsigned long b = 0; b < meshContainer->pSkinInfo->GetNumBones(); b++ ) { Frame *bone = (Frame*)D3DXFrameFind( m_firstFrame, meshContainer->pSkinInfo->GetBoneName( b ) ); if( bone == NULL ) continue; meshContainer->boneMatrixPointers[b] = &bone->finalTransformationMatrix; } // Keep track of the maximum bones out of all the mesh containers. if( m_totalBoneMatrices < meshContainer->pSkinInfo->GetNumBones() ) m_totalBoneMatrices = meshContainer->pSkinInfo->GetNumBones(); } // Check if the mesh has any materials. if( meshContainer->NumMaterials > 0 ) { // Load all the materials in via the material manager. for( unsigned long m = 0; m < meshContainer->NumMaterials; m++ ) { // Ensure the material has a texture. if( meshContainer->materialNames[m] != NULL ) { // Get the name of the material's script and load it. char *name = new char[strlen( meshContainer->materialNames[m] ) + 5]; sprintf( name, "%s.txt", meshContainer->materialNames[m] ); meshContainer->materials[m] = g_engine->GetMaterialManager()->Add( name, GetPath() ); SAFE_DELETE_ARRAY( name ); } } } } // Prepare the frame's siblings. if( frame->pFrameSibling != NULL ) PrepareFrame( (Frame*)frame->pFrameSibling ); // Prepare the frame's children. if( frame->pFrameFirstChild != NULL ) PrepareFrame( (Frame*)frame->pFrameFirstChild );}
开发者ID:BornHunter,项目名称:CGSF,代码行数:67,
示例10: PrintLognfsstat3 CNFS3Prog::ProcedureSETATTR(void){ char *path; sattr3 new_attributes; sattrguard3 guard; wcc_data obj_wcc; nfsstat3 stat; int nMode; FILE *pFile; HANDLE hFile; FILETIME fileTime; SYSTEMTIME systemTime; PrintLog("SETATTR"); path = GetPath(); Read(&new_attributes); Read(&guard); stat = CheckFile(path); obj_wcc.before.attributes_follow = GetFileAttributesForNFS(path, &obj_wcc.before.attributes); if (stat == NFS3_OK) { if (new_attributes.mode.set_it) { nMode = 0; if ((new_attributes.mode.mode & 0x100) != 0) { nMode |= S_IREAD; } // Always set read and write permissions (deliberately implemented this way) // if ((new_attributes.mode.mode & 0x80) != 0) { nMode |= S_IWRITE; // } // S_IEXEC is not availabile on windows // if ((new_attributes.mode.mode & 0x40) != 0) { // nMode |= S_IEXEC; // } if (_chmod(path, nMode) != 0) { stat = NFS3ERR_INVAL; } else { } } // deliberately not implemented because we cannot reflect uid/gid on windows (easliy) if (new_attributes.uid.set_it){} if (new_attributes.gid.set_it){} // deliberately not implemented if (new_attributes.mtime.set_it == SET_TO_CLIENT_TIME){} if (new_attributes.atime.set_it == SET_TO_CLIENT_TIME){} if (new_attributes.mtime.set_it == SET_TO_SERVER_TIME || new_attributes.atime.set_it == SET_TO_SERVER_TIME){ hFile = CreateFile(path, FILE_WRITE_ATTRIBUTES, FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, 0); if (hFile != INVALID_HANDLE_VALUE) { GetSystemTime(&systemTime); SystemTimeToFileTime(&systemTime, &fileTime); if (new_attributes.mtime.set_it == SET_TO_SERVER_TIME){ SetFileTime(hFile, NULL, NULL, &fileTime); } if (new_attributes.atime.set_it == SET_TO_SERVER_TIME){ SetFileTime(hFile, NULL, &fileTime, NULL); } } CloseHandle(hFile); } if (new_attributes.size.set_it){ pFile = _fsopen(path, "r+b", _SH_DENYWR); int filedes = _fileno(pFile); _chsize_s(filedes, new_attributes.size.size); fclose(pFile); } } obj_wcc.after.attributes_follow = GetFileAttributesForNFS(path, &obj_wcc.after.attributes); Write(&stat); Write(&obj_wcc); return stat;}
开发者ID:philr,项目名称:winnfsd,代码行数:83,
示例11: PlayerItvoid UBlinkyChaseBehaviorComponent::FindPath(){ auto Owner = static_cast<AGhost*>(GetOwner()); auto PathFollower = Owner->GetPathFollowingComponent(); TActorIterator<APacmanPlayer> PlayerIt(GetWorld()); GNavigationSystem->FindPathToLocation(Owner->GetActorLocation(), PlayerIt->GetActorLocation(), Owner->GetActorForwardVector(), PathFollower->GetPath()); PathFollower->StartPathFollowing();}
开发者ID:Xperience8,项目名称:Pacman,代码行数:10,
示例12: ATOMIC_LOGWARNINGbool TextureCube::BeginLoad(Deserializer& source){ ResourceCache* cache = GetSubsystem<ResourceCache>(); // In headless mode, do not actually load the texture, just return success if (!graphics_) return true; // If device is lost, retry later if (graphics_->IsDeviceLost()) { ATOMIC_LOGWARNING("Texture load while device is lost"); dataPending_ = true; return true; } cache->ResetDependencies(this); String texPath, texName, texExt; SplitPath(GetName(), texPath, texName, texExt); loadParameters_ = (new XMLFile(context_)); if (!loadParameters_->Load(source)) { loadParameters_.Reset(); return false; } loadImages_.Clear(); XMLElement textureElem = loadParameters_->GetRoot(); XMLElement imageElem = textureElem.GetChild("image"); // Single image and multiple faces with layout if (imageElem) { String name = imageElem.GetAttribute("name"); // If path is empty, add the XML file path if (GetPath(name).Empty()) name = texPath + name; SharedPtr<Image> image = cache->GetTempResource<Image>(name); if (!image) return false; int faceWidth, faceHeight; loadImages_.Resize(MAX_CUBEMAP_FACES); if (image->IsCubemap()) { loadImages_[FACE_POSITIVE_X] = image; loadImages_[FACE_NEGATIVE_X] = loadImages_[FACE_POSITIVE_X]->GetNextSibling(); loadImages_[FACE_POSITIVE_Y] = loadImages_[FACE_NEGATIVE_X]->GetNextSibling(); loadImages_[FACE_NEGATIVE_Y] = loadImages_[FACE_POSITIVE_Y]->GetNextSibling(); loadImages_[FACE_POSITIVE_Z] = loadImages_[FACE_NEGATIVE_Y]->GetNextSibling(); loadImages_[FACE_NEGATIVE_Z] = loadImages_[FACE_POSITIVE_Z]->GetNextSibling(); } else { CubeMapLayout layout = (CubeMapLayout)GetStringListIndex(imageElem.GetAttribute("layout").CString(), cubeMapLayoutNames, CML_HORIZONTAL); switch (layout) { case CML_HORIZONTAL: faceWidth = image->GetWidth() / MAX_CUBEMAP_FACES; faceHeight = image->GetHeight(); loadImages_[FACE_POSITIVE_Z] = GetTileImage(image, 0, 0, faceWidth, faceHeight); loadImages_[FACE_POSITIVE_X] = GetTileImage(image, 1, 0, faceWidth, faceHeight); loadImages_[FACE_NEGATIVE_Z] = GetTileImage(image, 2, 0, faceWidth, faceHeight); loadImages_[FACE_NEGATIVE_X] = GetTileImage(image, 3, 0, faceWidth, faceHeight); loadImages_[FACE_POSITIVE_Y] = GetTileImage(image, 4, 0, faceWidth, faceHeight); loadImages_[FACE_NEGATIVE_Y] = GetTileImage(image, 5, 0, faceWidth, faceHeight); break; case CML_HORIZONTALNVIDIA: faceWidth = image->GetWidth() / MAX_CUBEMAP_FACES; faceHeight = image->GetHeight(); for (unsigned i = 0; i < MAX_CUBEMAP_FACES; ++i) loadImages_[i] = GetTileImage(image, i, 0, faceWidth, faceHeight); break; case CML_HORIZONTALCROSS: faceWidth = image->GetWidth() / 4; faceHeight = image->GetHeight() / 3; loadImages_[FACE_POSITIVE_Y] = GetTileImage(image, 1, 0, faceWidth, faceHeight); loadImages_[FACE_NEGATIVE_X] = GetTileImage(image, 0, 1, faceWidth, faceHeight); loadImages_[FACE_POSITIVE_Z] = GetTileImage(image, 1, 1, faceWidth, faceHeight); loadImages_[FACE_POSITIVE_X] = GetTileImage(image, 2, 1, faceWidth, faceHeight); loadImages_[FACE_NEGATIVE_Z] = GetTileImage(image, 3, 1, faceWidth, faceHeight); loadImages_[FACE_NEGATIVE_Y] = GetTileImage(image, 1, 2, faceWidth, faceHeight); break; case CML_VERTICALCROSS: faceWidth = image->GetWidth() / 3; faceHeight = image->GetHeight() / 4; loadImages_[FACE_POSITIVE_Y] = GetTileImage(image, 1, 0, faceWidth, faceHeight); loadImages_[FACE_NEGATIVE_X] = GetTileImage(image, 0, 1, faceWidth, faceHeight); loadImages_[FACE_POSITIVE_Z] = GetTileImage(image, 1, 1, faceWidth, faceHeight); loadImages_[FACE_POSITIVE_X] = GetTileImage(image, 2, 1, faceWidth, faceHeight);//.........这里部分代码省略.........
开发者ID:EternalXY,项目名称:AtomicGameEngine,代码行数:101,
示例13: ASSERT// Return: false if deletedbool CItem::StartRefresh() { ASSERT(GetType() != IT_FREESPACE); ASSERT(GetType() != IT_UNKNOWN); m_ticksWorked = 0; // Special case IT_MYCOMPUTER if (GetType() == IT_MYCOMPUTER) { ZeroMemory(&m_lastChange, sizeof(m_lastChange)); for (int i=0; i < GetChildrenCount(); i++) GetChild(i)->StartRefresh(); return true; } ASSERT(GetType() == IT_FILE || GetType() == IT_DRIVE || GetType() == IT_DIRECTORY || GetType() == IT_FILESFOLDER); bool wasExpanded = IsVisible() && IsExpanded(); int oldScrollPosition = 0; if (IsVisible()) oldScrollPosition = GetScrollPosition(); UncacheImage(); // Upward clear data UpdateLastChange(); UpwardSetUndone(); UpwardAddReadJobs(-GetReadJobs()); ASSERT(GetReadJobs() == 0); if (GetType() == IT_FILE) GetParent()->UpwardAddFiles(-1); else UpwardAddFiles(-GetFilesCount()); ASSERT(GetFilesCount() == 0); if (GetType() == IT_DIRECTORY || GetType() == IT_DRIVE) UpwardAddSubdirs(-GetSubdirsCount()); ASSERT(GetSubdirsCount() == 0); UpwardAddSize(-GetSize()); ASSERT(GetSize() == 0); RemoveAllChildren(); UpwardRecalcLastChange(); // Special case IT_FILESFOLDER if (GetType() == IT_FILESFOLDER) { CFileFindWDS finder; BOOL b = finder.FindFile(GetFindPattern()); while (b) { b = finder.FindNextFile(); if (finder.IsDirectory()) continue; FILEINFO fi; fi.name = finder.GetFileName(); fi.attributes = finder.GetAttributes(); // Retrieve file size fi.length = finder.GetCompressedLength(); finder.GetLastWriteTime(&fi.lastWriteTime); AddFile(fi); UpwardAddFiles(1); } SetDone(); if (wasExpanded) GetTreeListControl()->ExpandItem(this); return true; } ASSERT(GetType() == IT_FILE || GetType() == IT_DRIVE || GetType() == IT_DIRECTORY); // The item may have been deleted. bool deleted = false; if (GetType() == IT_DRIVE) deleted = !DriveExists(GetPath()); else if (GetType() == IT_FILE) deleted = !FileExists(GetPath()); else if (GetType() == IT_DIRECTORY) deleted = !FolderExists(GetPath()); if (deleted) { if (GetParent() == NULL) { GetDocument()->UnlinkRoot(); } else { GetParent()->UpwardRecalcLastChange(); GetParent()->RemoveChild(GetParent()->FindChildIndex(this)); // --> delete this }//.........这里部分代码省略.........
开发者ID:coapp-packages,项目名称:windirstat,代码行数:101,
示例14: test_widenpathstatic void test_widenpath(void){ HDC hdc = GetDC(0); HPEN greenPen, narrowPen; POINT pnt[6]; INT nSize, ret; /* Create a pen to be used in WidenPath */ greenPen = CreatePen(PS_SOLID, 10, RGB(0,0,0)); SelectObject(hdc, greenPen); /* Prepare a path */ pnt[0].x = 100; pnt[0].y = 0; pnt[1].x = 200; pnt[1].y = 0; pnt[2].x = 300; pnt[2].y = 100; pnt[3].x = 300; pnt[3].y = 200; pnt[4].x = 200; pnt[4].y = 300; pnt[5].x = 100; pnt[5].y = 300; /* Set a polyline path */ BeginPath(hdc); Polyline(hdc, pnt, 6); EndPath(hdc); /* Widen the polyline path */ ok(WidenPath(hdc), "WidenPath fails while widening a poyline path./n"); /* Test if WidenPath seems to have done his job */ nSize = GetPath(hdc, NULL, NULL, 0); ok(nSize != -1, "GetPath fails after calling WidenPath./n"); ok(nSize > 6, "Path number of points is too low. Should be more than 6 but is %d/n", nSize); AbortPath(hdc); /* Test WidenPath with an open path (last error only set on Win2k and later) */ SetLastError(0xdeadbeef); BeginPath(hdc); ret = WidenPath(hdc); ok(ret == FALSE && (GetLastError() == ERROR_CAN_NOT_COMPLETE || GetLastError() == 0xdeadbeef), "WidenPath fails while widening an open path. Return value is %d, should be %d. Error is %u/n", ret, FALSE, GetLastError()); AbortPath(hdc); /* Test when the pen width is equal to 1. The path should change too */ narrowPen = CreatePen(PS_SOLID, 1, RGB(0,0,0)); SelectObject(hdc, narrowPen); BeginPath(hdc); Polyline(hdc, pnt, 6); EndPath(hdc); ret = WidenPath(hdc); nSize = GetPath(hdc, NULL, NULL, 0); ok(nSize > 6, "WidenPath should compute a widdened path with a 1px wide pen. Path length is %d, should be more than 6/n", nSize); ReleaseDC(0, hdc); return;}
开发者ID:mikekap,项目名称:wine,代码行数:62,
示例15: switchint CItem::CompareSibling(const CTreeListItem *tlib, int subitem) const{ CItem *other = (CItem *)tlib; int r=0; switch (subitem) { case COL_NAME: if (GetType() == IT_DRIVE) { ASSERT(other->GetType() == IT_DRIVE); r = signum(GetPath().CompareNoCase(other->GetPath())); } else { r = signum(m_name.CompareNoCase(other->m_name)); } break; case COL_SUBTREEPERCENTAGE: if (MustShowReadJobs()) r = signum(m_readJobs - other->m_readJobs); else r = signum(GetFraction() - other->GetFraction()); break; case COL_PERCENTAGE: r = signum(GetFraction() - other->GetFraction()); break; case COL_SUBTREETOTAL: r = signum(GetSize() - other->GetSize()); break; case COL_ITEMS: r = signum(GetItemsCount() - other->GetItemsCount()); break; case COL_FILES: r = signum(GetFilesCount() - other->GetFilesCount()); break; case COL_SUBDIRS: r = signum(GetSubdirsCount() - other->GetSubdirsCount()); break; case COL_LASTCHANGE: { if (m_lastChange < other->m_lastChange) return -1; else if (m_lastChange == other->m_lastChange) return 0; else return 1; } break; case COL_ATTRIBUTES: r = signum(GetSortAttributes() - other->GetSortAttributes()); break; default: ASSERT(false); break; } return r;}
开发者ID:coapp-packages,项目名称:windirstat,代码行数:66,
示例16: strInitialPromptbool CModel::WriteExternal(bool bPromptForNames, bool& bCFGWritten){ bCFGWritten = false; CString filename; if (bPromptForNames) { CString strInitialPrompt(ghAssimilateView->GetDocument()->GetPathName()); Filename_RemoveFilename(strInitialPrompt); strInitialPrompt.Replace("/","//"); strInitialPrompt += "//"; strInitialPrompt += sANIMATION_CFG_NAME; CFileDialog dialog(FALSE, ".cfg", strInitialPrompt, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, "Config Data Files (*.cfg)|*.cfg|All Files (*.*)|*.*||", NULL); if (dialog.DoModal() != IDOK) { return false; } filename = dialog.GetPathName(); // eg. {"Q:/quake/baseq3/models/players/ste_assimilate_test/ste_assimilate_test.cfg"} } else { filename = ((CAssimilateApp*)AfxGetApp())->GetQuakeDir(); filename+= GetPath(); filename.MakeLower(); filename.Replace('//', '/'); int loc = filename.Find(m_name);//"/root"); if (loc>=0) { filename = filename.Left(loc+strlen(m_name)); } // dup the dirname to use as the model name... (eg "/.../.../klingon" becomes "/.../.../klingon/klingon" filename += "/"; filename += sANIMATION_CFG_NAME; } CTxtFile* file = CTxtFile::Create(filename); if (file == NULL || !file->IsValid()) { ErrorBox(va("Error creating file /"%s/"!",filename)); return false; } // new bit, check for the existance of an animation.pre file, which means export this in Q3 format (rather than trek) CString strQ3FormatCheckName(filename); Filename_RemoveFilename(strQ3FormatCheckName); strQ3FormatCheckName += "//"; strQ3FormatCheckName += sANIMATION_PRE_NAME; strQ3FormatCheckName.Replace("/","//"); bool bExportFormatIsQuake3Multiplayer = //FileExists(strQ3FormatCheckName); ((CAssimilateApp*)AfxGetApp())->GetMultiPlayerMode(); CString strPrePend; if (bExportFormatIsQuake3Multiplayer) { // multi-player format, check for optional animation.pre file... FILE *fhPRE = fopen(strQ3FormatCheckName, "rt"); if (fhPRE) { // read all the lines in this file and just write them straight to the output file... char sLine[16384]; char *psLine; CString strTrimmed; while ((psLine = fgets( sLine, sizeof(sLine), fhPRE ))!=NULL) { strTrimmed = psLine; strTrimmed.Replace("/n",""); strTrimmed.TrimRight(); strTrimmed.TrimLeft(); file->Writeln(strTrimmed); } if (ferror(fhPRE)) { ErrorBox(va("Error during reading of file /"%s/"!/n/n( this shouldn't happen )",(LPCSTR)strQ3FormatCheckName)); } fclose(fhPRE); } file->Writeln(""); file->Writeln("//"); file->Writeln("// Format: targetFrame, frameCount, loopFrame, frameSpeed"); file->Writeln("//"); } else { // single-player format... CString commentLine; CTime time = CTime::GetCurrentTime(); commentLine.Format("// %s %d frames; %d sequences; updated %s", filename, m_totFrames, GetTotSequences(), time.Format("%H:%M %A, %B %d, %Y")); file->Writeln(commentLine); // the Writeln functions I have to call don't handle "/n" chars properly because of being opened in binary mode//.........这里部分代码省略.........
开发者ID:DT85,项目名称:Assimilate,代码行数:101,
示例17: GetPathbool CItem::HasUncPath() const{ CString path = GetPath(); return (path.GetLength() >= 2 && path.Left(2) == _T("////"));}
开发者ID:coapp-packages,项目名称:windirstat,代码行数:5,
示例18: ifJBooleanCBNewProjectSaveFileDialog::OKToDeactivate(){ if (!JXSaveFileDialog::OKToDeactivate()) { return kJFalse; } else if (Cancelled()) { return kJTrue; } const CBBuildManager::MakefileMethod method = GetMakefileMethod(); if (method == CBBuildManager::kManual) { return kJTrue; } // ask if OK to replace Make.files if (method == CBBuildManager::kMakemake) { const JString makeFilesName = CBBuildManager::GetMakeFilesName(GetPath()); if (JFileExists(makeFilesName) && !OKToReplaceFile(makeFilesName, JGetString("CBName"))) { return kJFalse; } } // ask if OK to replace CMakeLists.txt if (method == CBBuildManager::kCMake) { JString projFileName, projRoot, projSuffix; GetFileName(&projFileName); JSplitRootAndSuffix(projFileName, &projRoot, &projSuffix); const JString cmakeInputName = CBBuildManager::GetCMakeInputName(GetPath(), projRoot); if (JFileExists(cmakeInputName) && !OKToReplaceFile(cmakeInputName, JGetString("CBName"))) { return kJFalse; } } // ask if OK to replace .pro if (method == CBBuildManager::kQMake) { JString projFileName, projRoot, projSuffix; GetFileName(&projFileName); JSplitRootAndSuffix(projFileName, &projRoot, &projSuffix); const JString qmakeInputName = CBBuildManager::GetQMakeInputName(GetPath(), projRoot); if (JFileExists(qmakeInputName) && !OKToReplaceFile(qmakeInputName, JGetString("CBName"))) { return kJFalse; } } // ask if OK to replace existing Makefile JPtrArray<JString> makefileList(JPtrArrayT::kDeleteAll); CBBuildManager::GetMakefileNames(GetPath(), &makefileList); const JSize count = makefileList.GetElementCount(); for (JIndex i=1; i<=count; i++) { const JString* fullName = makefileList.NthElement(i); if (JFileExists(*fullName) && !OKToReplaceFile(*fullName, CBBuildManager::GetMakefileMethodName(GetMakefileMethod()))) { return kJFalse; } } return kJTrue;}
开发者ID:jafl,项目名称:jx_application_framework,代码行数:80,
示例19: GetPathbool UsdPrim::RemoveProperty(const TfToken &propName) { SdfPath propPath = GetPath().AppendProperty(propName); return _GetStage()->_RemoveProperty(propPath);}
开发者ID:JT-a,项目名称:USD,代码行数:6,
示例20: ifVError VFolder::CopyContentsTo( const VFolder& inDestinationFolder, FileCopyOptions inOptions) const{ VError err = VE_OK; if (!inDestinationFolder.Exists()) { // this easy case should be handled by system implementation err = inDestinationFolder.Create(); } else if (IsSameFolder( &inDestinationFolder) || inDestinationFolder.GetPath().IsChildOf( GetPath())) { StThrowFileError errThrow( this, VE_CANNOT_COPY_ON_ITSELF); errThrow->SetString( "destination", inDestinationFolder.GetPath().GetPath()); err = errThrow.GetError(); } if (err == VE_OK) { bool ok = true; for( VFolderIterator folderIterator( this, FI_WANT_FOLDERS | FI_WANT_INVISIBLES) ; folderIterator.IsValid() && ok ; ++folderIterator) { VError err2 = folderIterator->CopyTo( inDestinationFolder, NULL, inOptions); if (err == VE_OK) err = err2; ok = (err == VE_OK) | ((inOptions & FCP_ContinueOnError) != 0); } for( VFileIterator fileIterator( this, FI_WANT_FILES | FI_WANT_INVISIBLES) ; fileIterator.IsValid() && ok ; ++fileIterator) { VError err2 = fileIterator->CopyTo( inDestinationFolder, NULL, inOptions); if (err == VE_OK) err = err2; ok = (err == VE_OK) | ((inOptions & FCP_ContinueOnError) != 0); } } return err;}
开发者ID:sanyaade-webdev,项目名称:core-XToolbox,代码行数:38,
示例21: _GetStagevoidUsdPrim::Load() const{ _GetStage()->Load(GetPath());}
开发者ID:JT-a,项目名称:USD,代码行数:5,
示例22: strncpybool CFLTKEditor::HighlightLinePos(const char *pcFilename, int iInputPos){ if (iInputPos < 0) return false; int iTextPos, iLineStart, iLineEnd; char pcSearchName[300], *pcPoint; string sName; strncpy(pcSearchName, pcFilename, 299); if ((pcPoint = strstr(pcSearchName, ".clu"))) { *pcPoint = 0; }// if (GetFilename().size() == 0) sName = GetPath() + GetName();// else// sName = GetFilename(); if (pcSearchName != sName) { int i, iCount = m_mEditorData.Count(); for (i = 0; i < iCount; i++) { //sName = m_mEditorData[i].m_sFilename; //if (sName.size() == 0) //{ sName = m_mEditorData[i].m_sPath + m_mEditorData[i].m_sName; //} if (sName == pcSearchName) { SetCurEditor(i); m_pFileChoice->value(i); break; } } // File not opened yet if (i == iCount) { sName = pcSearchName; sName = sName + ".clu"; CFLTKEditor::New(); CFLTKEditor::LoadFile(sName.c_str()); UpdateFileList(); } } //iTextPos = GetTextBuffer()->skip_lines(0, iLine-1); iTextPos = iInputPos + 1; if (iTextPos >= GetTextBuffer()->length()) iTextPos = GetTextBuffer()->length()-2; iLineStart = GetTextBuffer()->line_start(iTextPos); iLineEnd = GetTextBuffer()->line_end(iTextPos); GetTextBuffer()->select(iLineStart, iLineEnd); GetEditor()->insert_position(iTextPos); GetEditor()->show_insert_position(); GetTextBuffer()->call_modify_callbacks(); return true;}
开发者ID:foobarz,项目名称:CLUCalcLinux,代码行数:67,
示例23: Closebool File::OpenInternal(const String& fileName, FileMode mode, bool fromPackage){ Close(); compressed_ = false; readSyncNeeded_ = false; writeSyncNeeded_ = false; FileSystem* fileSystem = GetSubsystem<FileSystem>(); if (fileSystem && !fileSystem->CheckAccess(GetPath(fileName))) { ATOMIC_LOGERRORF("Access denied to %s", fileName.CString()); return false; } if (fileName.Empty()) { ATOMIC_LOGERROR("Could not open file with empty name"); return false; }#ifdef __ANDROID__ if (ATOMIC_IS_ASSET(fileName)) { if (mode != FILE_READ) { ATOMIC_LOGERROR("Only read mode is supported for Android asset files"); return false; } assetHandle_ = SDL_RWFromFile(ATOMIC_ASSET(fileName), "rb"); if (!assetHandle_) { ATOMIC_LOGERRORF("Could not open Android asset file %s", fileName.CString()); return false; } else { fileName_ = fileName; mode_ = mode; position_ = 0; if (!fromPackage) { size_ = SDL_RWsize(assetHandle_); offset_ = 0; } checksum_ = 0; return true; } }#endif#ifdef _WIN32 handle_ = _wfopen(GetWideNativePath(fileName).CString(), openMode[mode]);#else handle_ = fopen(GetNativePath(fileName).CString(), openMode[mode]);#endif // If file did not exist in readwrite mode, retry with write-update mode if (mode == FILE_READWRITE && !handle_) {#ifdef _WIN32 handle_ = _wfopen(GetWideNativePath(fileName).CString(), openMode[mode + 1]);#else handle_ = fopen(GetNativePath(fileName).CString(), openMode[mode + 1]);#endif } if (!handle_) { ATOMIC_LOGERRORF("Could not open file %s", fileName.CString()); return false; } if (!fromPackage) { fseek((FILE*)handle_, 0, SEEK_END); long size = ftell((FILE*)handle_); fseek((FILE*)handle_, 0, SEEK_SET); if (size > M_MAX_UNSIGNED) { ATOMIC_LOGERRORF("Could not open file %s which is larger than 4GB", fileName.CString()); Close(); size_ = 0; return false; } size_ = (unsigned)size; offset_ = 0; } fileName_ = fileName; mode_ = mode; position_ = 0; checksum_ = 0; return true;}
开发者ID:EternalXY,项目名称:AtomicGameEngine,代码行数:97,
示例24: wxSplitPath// this function is called a *lot* of times (as I learned after seeing from// profiler output that it is called ~12000 times from Mahogany start up code!)// so it is important to optimize it - in particular, avoid using generic// string functions here and do everything manually because it is faster//// I still kept the old version to be able to check that the optimized code has// the same output as the non optimized version.void wxRegConfig::SetPath(const wxString& strPath){ // remember the old path wxString strOldPath = m_strPath;#ifdef WX_DEBUG_SET_PATH // non optimized version kept here for testing wxString m_strPathAlt; { wxArrayString aParts; // because GetPath() returns "" when we're at root, we must understand // empty string as "/" if ( strPath.IsEmpty() || (strPath[0] == wxCONFIG_PATH_SEPARATOR) ) { // absolute path wxSplitPath(aParts, strPath); } else { // relative path, combine with current one wxString strFullPath = GetPath(); strFullPath << wxCONFIG_PATH_SEPARATOR << strPath; wxSplitPath(aParts, strFullPath); } // recombine path parts in one variable wxString strRegPath; m_strPathAlt.Empty(); for ( size_t n = 0; n < aParts.Count(); n++ ) { strRegPath << '//' << aParts[n]; m_strPathAlt << wxCONFIG_PATH_SEPARATOR << aParts[n]; } }#endif // 0 // check for the most common case first if ( strPath.empty() ) { m_strPath = wxCONFIG_PATH_SEPARATOR; } else // not root { // construct the full path wxString strFullPath; if ( strPath[0u] == wxCONFIG_PATH_SEPARATOR ) { // absolute path strFullPath = strPath; } else // relative path { strFullPath.reserve(2*m_strPath.length()); strFullPath << m_strPath; if ( strFullPath.Len() == 0 || strFullPath.Last() != wxCONFIG_PATH_SEPARATOR ) strFullPath << wxCONFIG_PATH_SEPARATOR; strFullPath << strPath; } // simplify it: we need to handle ".." here // count the total number of slashes we have to know if we can go upper size_t totalSlashes = 0; // position of the last slash to be able to backtrack to it quickly if // needed, but we set it to -1 if we don't have a valid position // // we only remember the last position which means that we handle ".." // quite efficiently but not "../.." - however the latter should be // much more rare, so it is probably ok int posLastSlash = -1; const wxChar *src = strFullPath.c_str(); size_t len = strFullPath.length(); const wxChar *end = src + len; wxStringBufferLength buf(m_strPath, len); wxChar *dst = buf; wxChar *start = dst; for ( ; src < end; src++, dst++ ) { if ( *src == wxCONFIG_PATH_SEPARATOR ) { // check for "/.." // note that we don't have to check for src < end here as // *end == 0 so can't be '.' if ( src[1] == _T('.') && src[2] == _T('.') && (src + 3 == end || src[3] == wxCONFIG_PATH_SEPARATOR) ) { if ( !totalSlashes ) {//.........这里部分代码省略.........
开发者ID:Duion,项目名称:Torsion,代码行数:101,
注:本文中的GetPath函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ GetPathAtMapEnd函数代码示例 C++ GetPassword函数代码示例 |