| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- #include "StdAfx.h"
- #include "InstallXmlInfo2.h"
- #include "markup.h"
- CInstallXmlInfo2::CInstallXmlInfo2(CString strFile)
- {
- CMarkup xml;
- xml.Load(strFile);
- xml.FindElem(); // root ORDER element
- xml.IntoElem(); // inside ORDER
- if( xml.FindElem(_T("install_dir")) )
- {
- this->sysPath = GetSysPath(xml.GetAttrib(_T("syspath")));
- this->corpPath = sysPath +_T("\\")+xml.GetAttrib(_T("corp"));
- this->productPath = corpPath +_T("\\")+xml.GetAttrib(_T("product"));
- xml.IntoElem();
- if( xml.FindElem(_T("mainapp")) )
- {
- this->appPath = productPath + _T("\\")+xml.GetData();
- list.Add(this->appPath);
- }
- if( xml.FindElem(_T("data")) )
- {
- this->dataPath = productPath + _T("\\")+xml.GetData();
- list.Add(this->dataPath);
- }
- if( xml.FindElem(_T("cache")) )
- {
- this->cachePath = productPath + _T("\\")+xml.GetData();
- list.Add(this->cachePath);
- }
- if( xml.FindElem(_T("log")) )
- {
- this->logPath = productPath + _T("\\")+xml.GetData();
- list.Add(this->logPath);
- }
- if( xml.FindElem(_T("temp")) )
- {
- this->tempPath = productPath + _T("\\")+xml.GetData();
- }
-
- xml.OutOfElem();
- }
- /*if( xml.FindElem(_T("file_list")) )
- {
- xml.IntoElem();
- while( xml.FindElem(_T("file")))
- {
- CFileLocationInfo info;
- info.fileName = xml.GetData();
- info.fileType = xml.GetAttrib(_T("type"));
- info.subDir = xml.GetAttrib(_T("subdir"));
- locations.Add(info);
- }
- xml.OutOfElem();
- }*/
- xml.OutOfElem();
- }
- CInstallXmlInfo2::~CInstallXmlInfo2(void)
- {
- }
- CString CInstallXmlInfo2::GetSysPath(CString sEnvironmentName)
- {
-
- TCHAR buffer[1024];
- DWORD dwRet = GetEnvironmentVariable(sEnvironmentName, buffer, sizeof(buffer));
- CString value;
- if (dwRet > 0)
- {
- value = buffer;
- }
- return value;
- }
|