void CCamSettingDlg::OnBnClickedBnPathSearch() { // TODO: Add your control notification handler code here BROWSEINFO bi={0}; bi.pidlRoot=NULL; bi.hwndOwner=this->GetSafeHwnd(); bi.lpszTitle=_T("ÇëÑ¡Ôñ±£´æͼƬµÄÎļþ¼Ð."); bi.ulFlags=BIF_RETURNFSANCESTORS; LPITEMIDLIST lpidlist=SHBrowseForFolder(&bi); if(lpidlist==NULL) return; TCHAR pathtmp[MAX_PATH]; memset(pathtmp,0,MAX_PATH); if(!SHGetPathFromIDList(lpidlist,pathtmp)) return; SetDlgItemText(IDC_ED_PATH2SAVE,pathtmp); string strpath(pathtmp); if(strpath!=theApp.m_CCD.m_path2save||m_image_type!=theApp.m_CCD.m_image_type) { theApp.m_CCD.m_path2save=strpath; Csettings *settings=Csettings::getInstance(); //settings->setpath2save(strpath); // #ifdef XMLDOM settings->set_image_attr_dom(m_path2save,m_image_type); #else settings->set_image_attr(m_path2save,m_image_type); #endif //string path,strtype; //DS_FILE_TYPE type; //settings->get_image_attr(path,type); //switch(type) //{ // case FILE_JPG: // strtype=_T("jpg"); // break; // case FILE_BMP: // strtype=_T("bmp"); // break; // case FILE_RAW: // strtype=_T("raw"); // break; //} //CString cstr; //cstr.Format(_T("after set: path = %s,type = %s"),path.c_str(),strtype.c_str()); //MessageBox(cstr.GetBuffer()); } }
bool CStorageDir::CreatePackageDir() { if (m_packageNum >= PACKAGE_MAXNUM) return false; std::string strpath(m_storagePath); bool bret = m_packageArray[m_packageNum].InitPackage(m_packageBeginID , m_packageBeginID + m_packageNum, m_storagePath,this); if(bret) { m_packageNum += 1; m_packageEndID = m_packageBeginID + m_packageNum -1; return WriteStorageDirInfo(strpath + s_allocInfoFileName); } return bret; }
Path UtilsWin::convertPathTo83Path(const Path& path) { Path ret = path; std::string strpath(path.string()); DWORD lenght; lenght = GetShortPathName(strpath.c_str(), NULL, 0); if (lenght > 0) { auto p = std::make_unique<TCHAR[]>(lenght); lenght = GetShortPathName(strpath.c_str(), p.get(), lenght); if (lenght > 0) ret = p.get(); } return ret; }
bool Project::HasLocalInclude(const char *path) { if (!path) return false; BString strpath(path); for (int32 i = 0; i < fLocalIncludeList.CountItems(); i++) { ProjectPath *str = fLocalIncludeList.ItemAt(i); if (!str) continue; if (strpath.Compare(str->Absolute()) == 0) return true; } return false; }
const StringValue* XMLElementNode::QueryAtt(const char* path) { const char* pDot = strchr(path, '.'); if(!pDot) { const XMLAttribute* pAtt = this->GetAttribute(path); if(!pAtt) return NULL; return &pAtt->m_value; } else { int len = int(pDot - path); KXmlString strpath(path, len); XMLElementNode* pElem = this->Query(strpath.c_str()); if(!pElem) return NULL; const XMLAttribute* pAtt = pElem->GetAttribute(pDot+1); if(!pAtt) return NULL; return &pAtt->m_value; } return NULL; }
void Project::Save(const char *path) { BString projectPath = fPath.GetFolder(); projectPath << "/"; BString data; data << "NAME=" << fName << "\nTARGETNAME=" << fTargetName << "\n"; data << "PLATFORM=" << sPlatformArray[fPlatform] << "\n"; switch (fSCMType) { case SCM_HG: { data << "SCM=hg\n"; break; } case SCM_GIT: { data << "SCM=git\n"; break; } case SCM_SVN: { data << "SCM=svn\n"; break; } case SCM_NONE: { data << "SCM=none\n"; break; } default: { break; } } for (int32 i = 0; i < CountGroups(); i++) { SourceGroup *group = GroupAt(i); data << "GROUP=" << group->name << "\n"; data << "EXPANDGROUP=" << (group->expanded ? "yes" : "no") << "\n"; for (int32 j = 0; j < group->filelist.CountItems(); j++) { SourceFile *file = group->filelist.ItemAt(j); BString temppath(file->GetPath().GetFullPath()); if (temppath.FindFirst(projectPath.String()) == 0) { // Absolute paths which include the project folder are stripped // down into relative paths temppath.RemoveFirst(projectPath.String()); } data << "SOURCEFILE=" << temppath << "\n"; if (file->GetDependencies() && strlen(file->GetDependencies()) > 0) data << "DEPENDENCY=" << file->GetDependencies() << "\n"; } } for (int32 i = 0; i < fLocalIncludeList.CountItems(); i++) data << "LOCALINCLUDE=" << fLocalIncludeList.ItemAt(i)->Relative() << "\n"; for (int32 i = 0; i < fSystemIncludeList.CountItems(); i++) { BString *string = fSystemIncludeList.ItemAt(i); BString include = *string; if (include[0] == '/') include.RemoveFirst(projectPath.String()); data << "SYSTEMINCLUDE=" << include << "\n"; } for (int32 i = 0; i < fLibraryList.CountItems(); i++) { SourceFile *file = (SourceFile*)fLibraryList.ItemAt(i); if (!file) continue; BString strpath(file->GetPath().GetFullPath()); if (gPlatform == PLATFORM_ZETA) { if (strpath.FindFirst("/boot/beos/etc/develop/zeta-r1-gcc2-x86/") == 0) strpath.ReplaceFirst("/boot/beos/etc/develop/zeta-r1-gcc2-x86/", "/boot/develop/"); } if (strpath.FindFirst(projectPath.String()) == 0) strpath.RemoveFirst(projectPath.String()); data << "LIBRARY=" << strpath.String() << "\n"; } data << "RUNARGS=" << fRunArgs << "\n"; data << "CCDEBUG=" << (fDebug ? "yes" : "no") << "\n"; data << "CCPROFILE=" << (fProfile ? "yes" : "no") << "\n"; data << "CCOPSIZE=" << (fOpSize ? "yes" : "no") << "\n"; data << "CCOPLEVEL=" << (int)fOpLevel << "\n"; data << "CCTARGETTYPE=" << fTargetType << "\n"; data << "CCEXTRA=" << fExtraCompilerOptions << "\n"; data << "LDEXTRA=" << fExtraLinkerOptions << "\n"; BFile file(path,B_READ_WRITE | B_CREATE_FILE | B_ERASE_FILE); if (file.InitCheck() != B_OK) { STRACE(2,("Couldn't create project file %s. Bailing out\n",path)); return; } STRACE(2,("Saved Project %s. Data as follows:\n%s\n",path,data.String())); file.Write(data.String(),data.Length()); fPath = path; fObjectPath = fPath.GetFolder(); BString objfolder("(Objects."); objfolder << GetName() << ")"; fObjectPath.Append(objfolder.String()); BNodeInfo nodeInfo(&file); nodeInfo.SetType(PROJECT_MIME_TYPE); UpdateBuildInfo(); }