// PathManager.cpp: implementation of the CPathManager class. // ////////////////////////////////////////////////////////////////////// #include "stdafx.h" #include "Peeper.h" #include "PathManager.h" #ifdef _DEBUG #undef THIS_FILE static char THIS_FILE[]=__FILE__; #define new DEBUG_NEW #endif ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// CPathManager::CPathManager() { } void CPathManager::ScanRegistry() { HKEY dirkey; if(ERROR_SUCCESS==RegOpenKey(HKEY_CURRENT_USER,"Software\\Microsoft\\Devstudio\\6.0\\Build System\\Components\\Platforms\\Win32 (x86)\\Directories",&dirkey)) { char cstr[8096]; DWORD size=8096; if(ERROR_SUCCESS==RegQueryValueEx(dirkey,"Include Dirs",NULL,NULL,(unsigned char *)cstr,&size)) { CString str=cstr; int start=0,end; end=str.Find(';'); while(end>=0) { AddPath(str.Mid(start,end-start)); start=end+1; end=str.Find(';',start); } AddPath(str.Mid(start)); } RegCloseKey(dirkey); } } bool SysGetFile(const char *fname,const CString &path,CString &outbuf) { OFSTRUCT ofs; HFILE file; file=OpenFile(path+fname,&ofs,OF_READ); if(file==HFILE_ERROR) return false; DWORD rbts,fsize=GetFileSize((HANDLE)file,NULL); char *buf=new char[fsize]; ReadFile((HANDLE)file,buf,fsize,&rbts, NULL); outbuf = buf; delete buf; CloseHandle((HANDLE)file); // outbuf.Replace("\x0D\x0A","\n"); return true; } bool CPathManager::DoesFileExist(const char *fname,const CString &path) { OFSTRUCT ofs; HFILE file; file=OpenFile(path+fname,&ofs,OF_READ); if(file==HFILE_ERROR) return false; CloseHandle((HANDLE)file); return true; } bool CPathManager::GetPath(const char *fname,CString &path) { for(int i=0;i=0) { endl=file_data.Find('\n',startcpp); if(endl<0) endl=file_data.GetLength(); int startinc=0; startinc=file_data.Find("/I",startinc); while(startinc>=0 && startinc