OTSFileSys.cpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640
  1. #pragma once
  2. // OTSFileSys.cpp : implementation file
  3. //
  4. #include "stdafx.h"
  5. #include "OTSFileSys.h"
  6. #include "OTSHelper.h"
  7. #include "COTSUtilityDllFunExport.h"
  8. // COTSFileSys
  9. namespace OTSTools {
  10. //using namespace NSLogTools;
  11. // COTSFileSys member functions
  12. // private functions:
  13. const CString STR_COFIGPATH = _T("Config");
  14. const CString STR_APPNAME_OTSINCA = _T("OTSIncA");
  15. const CString STR_APPNAME_OTSPARTA = _T("OTSPartA");
  16. const CString STR_SYSTEM_DATA = _T("SysData");
  17. const CString STR_PROG_DATA = _T("ProData");
  18. const CString STR_MEASURE_PREFERENCE_FILE_NAME = _T("OTSProgMgrParam.pmf");
  19. const CString STR_REPORT_PREFERENCE_FILE_NAME = _T("OTSReportMgrParam.rpf");
  20. //SySSTDData.db
  21. const CString SYS_STD_LIB_FILE_NAME = _T("IncASTDData.db");
  22. const CString SYS_PartSTD_LIB_FILE_NAME = _T("PartASTDData.db");
  23. const CString STR_LOG = _T("Log");
  24. const CString TEXTFILE_FILE_EXT = _T(".txt");
  25. const CString TEXTFILE_FILTER = _T("Text Files (*.txt)|*.txt|All Files (*.*)|*.*||");
  26. const CString TEXTAPTF_FILE_FILTER = _T("Text Files (*.txt)|*.txt|(*.psf)|*.psf|All Files (*.*)|*.*||");
  27. const CString OTS_TEXT_FILE_COMMENT = _T("//");
  28. const CString LINE_END = _T("\r\n");
  29. const CString FILE_TITLE_SPLIT = _T(":");
  30. const CString FILE_VALUE_SPLIT = _T(",");
  31. const int TEXTFILE_ITEM_COLUMN_NUMBER = 2;
  32. const int FILE_SUFFIX_NUMBER = 4;
  33. COTSFileSys::COTSFileSys()
  34. {
  35. }
  36. COTSFileSys::~COTSFileSys()
  37. {
  38. }
  39. BOOL HasAttribute(LPCTSTR a_strFolder, DWORD a_nAttribute)
  40. {
  41. DWORD flags = GetFileAttributes(a_strFolder);
  42. return (flags != INVALID_FILE_ATTRIBUTES) &&
  43. (flags & a_nAttribute);
  44. }
  45. // check if the file exists or not
  46. BOOL COTSFileSys::Exists(LPCTSTR a_sPath)
  47. {
  48. return ::PathFileExists(a_sPath) == TRUE;
  49. }
  50. // check if the given string is valid file name or not
  51. BOOL COTSFileSys::IsValidFileName(LPCTSTR a_sFileName)
  52. {
  53. CString strFileName = a_sFileName;
  54. const CString INVALIDFILENAMECHAR(_T("\\/:*?\"<>"));
  55. return strFileName.FindOneOf(INVALIDFILENAMECHAR) == -1;
  56. }
  57. // copy a file
  58. BOOL COTSFileSys::CopyAFile(LPCTSTR a_strSourceFile, LPCTSTR a_strTargetFile, const BOOL a_bOverwrite /*= FALSE*/)
  59. {
  60. // make sure the two file name string are not empty
  61. ASSERT(a_strSourceFile);
  62. ASSERT(a_strTargetFile);
  63. if (!a_strSourceFile || !a_strTargetFile)
  64. {
  65. LogErrorTrace(__FILE__, __LINE__, _T("CopyAFile: invalid file name"));
  66. return FALSE;
  67. }
  68. // make sure the source file exist
  69. if (!Exists(a_strSourceFile))
  70. {
  71. LogErrorTrace(__FILE__, __LINE__, _T("CopyAFile: source file doesn't exist"));
  72. return FALSE;
  73. }
  74. // quit if the target file exists and can't be overwritten
  75. if (!a_bOverwrite && Exists(a_strTargetFile))
  76. {
  77. LogErrorTrace(__FILE__, __LINE__, _T("CopyAFile: target file exists and can't be overwritten"));
  78. return FALSE;
  79. }
  80. // copy file
  81. if (!::CopyFile(a_strSourceFile, a_strTargetFile, !a_bOverwrite))
  82. {
  83. LogErrorTrace(__FILE__, __LINE__, _T("CopyAFile: copy(%s) file to %s failed.error : %s"), a_strSourceFile, a_strTargetFile, COTSHelper::GetSystemErrorString(GetLastError()));
  84. return FALSE;
  85. }
  86. // ok, return TRUE
  87. return TRUE;
  88. }
  89. // move a file
  90. BOOL COTSFileSys::MoveAFile(LPCTSTR a_strSourceFile, LPCTSTR a_strTargetFile, const BOOL a_bOverwrite /*= TRUE*/)
  91. {
  92. // make sure the two file name string are not empty
  93. ASSERT(a_strSourceFile);
  94. ASSERT(a_strTargetFile);
  95. if (!a_strSourceFile || !a_strTargetFile)
  96. {
  97. LogErrorTrace(__FILE__, __LINE__, _T("MoveAFile: invalid file name"));
  98. return FALSE;
  99. }
  100. // make sure the source file exist
  101. if (!Exists(a_strSourceFile))
  102. {
  103. LogErrorTrace(__FILE__, __LINE__, _T("MoveAFile: source file doesn't exist"));
  104. return FALSE;
  105. }
  106. // the target exists?
  107. if (Exists(a_strTargetFile))
  108. {
  109. // quit if the target file can't be overwritten
  110. if(!a_bOverwrite)
  111. {
  112. LogErrorTrace(__FILE__, __LINE__, _T("MoveAFile: target file exists and can't be overwritten"));
  113. return FALSE;
  114. }
  115. if (DeleteAFile(a_strTargetFile))
  116. {
  117. LogErrorTrace(__FILE__, __LINE__, _T("MoveAFile: can't delete the exist file %s"), a_strTargetFile);
  118. return FALSE;
  119. }
  120. }
  121. if (!::MoveFile(a_strSourceFile, a_strTargetFile))
  122. {
  123. LogErrorTrace(__FILE__, __LINE__, _T("MoveAFile: move(%s) file to %s failed.error : %s"), a_strSourceFile, a_strTargetFile, COTSHelper::GetSystemErrorString(GetLastError()));
  124. return FALSE;
  125. }
  126. // ok, return TRUE
  127. return TRUE;
  128. }
  129. // delete a file.
  130. BOOL COTSFileSys::DeleteAFile(LPCTSTR a_strFileName)
  131. {
  132. // make sure the file name string is not empty
  133. ASSERT(a_strFileName);
  134. if (!a_strFileName)
  135. {
  136. LogErrorTrace(__FILE__, __LINE__, _T("DeleteAFile: invalid file name"));
  137. return FALSE;
  138. }
  139. // return TRUE if the file is not exist
  140. if (!Exists(a_strFileName))
  141. {
  142. LogErrorTrace(__FILE__, __LINE__, _T("DeleteAFile: %s file does not exist."), a_strFileName);
  143. return TRUE;
  144. }
  145. // quit if the file is read-only
  146. if (!IsReadOnly(a_strFileName))
  147. {
  148. LogErrorTrace(__FILE__, __LINE__, _T("DeleteAFile: %s file is readonly."), a_strFileName);
  149. return FALSE;
  150. }
  151. if (!::DeleteFile(a_strFileName))
  152. {
  153. LogErrorTrace(__FILE__, __LINE__, _T("DeleteAFile: delete (%s) file failed. error: %s"), a_strFileName, COTSHelper::GetSystemErrorString(GetLastError()));
  154. }
  155. // ok, return TRUE
  156. return TRUE;
  157. }
  158. // delete all files in the folder
  159. BOOL COTSFileSys::DeleteAllFiles(LPCTSTR a_strFolder, LPCTSTR a_sFilter /*= nullptr*/)
  160. {
  161. // make sure the folder name string are not empty
  162. ASSERT(a_strFolder);
  163. if (!a_strFolder)
  164. {
  165. LogErrorTrace(__FILE__, __LINE__, _T("DeleteAllFiles: invalid folder name"));
  166. return FALSE;
  167. }
  168. // return TRUE if the folder is not exist
  169. if (!Exists(a_strFolder))
  170. {
  171. LogErrorTrace(__FILE__, __LINE__, _T("DeleteAllFiles: %s folder does not exist."), a_strFolder);
  172. return TRUE;
  173. }
  174. // make sure this is a folder
  175. if (!IsFolder(a_strFolder))
  176. {
  177. LogErrorTrace(__FILE__, __LINE__, _T("DeleteAllFiles: %s is not a folder."), a_strFolder);
  178. return FALSE;
  179. }
  180. // is the folder read-only?
  181. if (!IsReadOnly(a_strFolder))
  182. {
  183. LogErrorTrace(__FILE__, __LINE__, _T("DeleteAllFiles: %s folder is readonly."), a_strFolder);
  184. return FALSE;
  185. }
  186. // get all files in the folder
  187. CFileFind searchFile;
  188. CString filePattern(a_strFolder);
  189. if (filePattern)
  190. {
  191. filePattern += _T("\\");
  192. filePattern += a_sFilter;
  193. }
  194. else
  195. {
  196. filePattern += _T("\\*.*");
  197. }
  198. BOOL ret = searchFile.FindFile(filePattern);
  199. // delete all files in the folder
  200. while (ret)
  201. {
  202. // get a file from the folder
  203. ret = searchFile.FindNextFile();
  204. // make sure that this is a real file, jump over if is not
  205. if (searchFile.IsDots() || searchFile.IsDirectory())
  206. {
  207. continue;
  208. }
  209. // delete the file
  210. if (!DeleteAFile(searchFile.GetFilePath()))
  211. {
  212. LogErrorTrace(__FILE__, __LINE__, _T("DeleteAllFiles: delete (%s) file failed."), searchFile.GetFilePath());
  213. return FALSE;
  214. }
  215. }
  216. searchFile.Close();
  217. // ok, return TRUE
  218. return TRUE;
  219. }
  220. // creates a folder.
  221. BOOL COTSFileSys::CreateFolder(LPCTSTR a_strFolder)
  222. {
  223. // make sure the folder name string are not empty
  224. CString strFolder = a_strFolder;
  225. strFolder.Trim();
  226. if (strFolder.IsEmpty())
  227. {
  228. LogErrorTrace(__FILE__, __LINE__, "CreateFolder: invalid folder name is empty.");
  229. return FALSE;
  230. }
  231. // if the folder exist?
  232. if (Exists(strFolder))
  233. {
  234. // is a real folder?
  235. if (IsFolder(strFolder))
  236. {
  237. return TRUE;
  238. }
  239. }
  240. // create folder
  241. // remove back slash if there
  242. CString strParentFolder = strFolder;
  243. strParentFolder.Trim(_T("\\"));
  244. // find last back slash position
  245. int nBackSlashPos = strParentFolder.ReverseFind(_T('\\'));
  246. if (nBackSlashPos > 0)
  247. {
  248. // get the folder name
  249. CString strFolderName = strParentFolder.Right(strParentFolder.GetLength() - nBackSlashPos - 1);
  250. // separate the folder string
  251. strParentFolder = strParentFolder.Left(nBackSlashPos);
  252. if (!IsValidFileName(strFolderName))
  253. {
  254. LogErrorTrace(__FILE__, __LINE__, "CreateFolder: invalid folder or file name %s.", strFolderName);
  255. return FALSE;
  256. }
  257. // try to create folder from the base folder
  258. if (!CreateFolder(strParentFolder))
  259. {
  260. LogErrorTrace(__FILE__, __LINE__, "CreateFolder: failed to create %s folder.", strParentFolder);
  261. return FALSE;
  262. }
  263. }
  264. // create the folder
  265. BOOL bRet = ::CreateDirectory(strFolder, NULL) == TRUE;
  266. // return folder create result
  267. return bRet;
  268. }
  269. // deletes a folder and contents recursively.
  270. BOOL COTSFileSys::DeleteFolder(LPCTSTR a_strFolder)
  271. {
  272. // make sure the folder name string are not empty
  273. CString strFolder = a_strFolder;
  274. strFolder.Trim();
  275. if (strFolder.IsEmpty())
  276. {
  277. LogErrorTrace(__FILE__, __LINE__, _T("CreateFolder: invalid folder name is empty."));
  278. return FALSE;
  279. }
  280. // quit if the folder is not exist
  281. if (!Exists(strFolder))
  282. {
  283. LogErrorTrace(__FILE__, __LINE__, _T("DeleteFolder: %s folder is not exist."), strFolder);
  284. return TRUE;
  285. }
  286. // make sure it is a folder
  287. if (!IsFolder(strFolder))
  288. {
  289. LogErrorTrace(__FILE__, __LINE__, _T("DeleteFolder: %s is a folder."), strFolder);
  290. return FALSE;
  291. }
  292. // readonly?
  293. if (!IsReadOnly(strFolder))
  294. {
  295. LogErrorTrace(__FILE__, __LINE__, _T("DeleteFolder: %s folder is readonly."), strFolder);
  296. return FALSE;
  297. }
  298. // remove every thing in the folder
  299. CFileFind fileSearch;
  300. CString filePattern(strFolder);
  301. filePattern += _T("\\*.*");
  302. BOOL ret = fileSearch.FindFile(filePattern);
  303. while (ret)
  304. {
  305. // get a file or a folder
  306. ret = fileSearch.FindNextFile();
  307. // jump over if this is a dots item
  308. if (fileSearch.IsDots())
  309. {
  310. continue;
  311. }
  312. // is a sub folder
  313. if (fileSearch.IsDirectory())
  314. {
  315. // delete the sub folder
  316. if (!DeleteFolder(fileSearch.GetFilePath()))
  317. {
  318. LogErrorTrace(__FILE__, __LINE__, _T("DeleteFolder: delete %s sub folder failed."), fileSearch.GetFilePath());
  319. return FALSE;
  320. }
  321. }
  322. // or a file, delete the file
  323. else if (!DeleteAFile(fileSearch.GetFilePath()))
  324. {
  325. LogErrorTrace(__FILE__, __LINE__, _T("DeleteFolder: delete %s file failed."), fileSearch.GetFilePath());
  326. return FALSE;
  327. }
  328. }
  329. // delete the folderstrFolder
  330. if (!::RemoveDirectory(a_strFolder))
  331. {
  332. LogErrorTrace(__FILE__, __LINE__, _T("DeleteFolder: remove directory %s failed."), strFolder);
  333. return FALSE;
  334. }
  335. // ok return TRUE
  336. return TRUE;
  337. }
  338. // check if this is an existing folder
  339. BOOL COTSFileSys::IsFolder(LPCTSTR a_strFolder)
  340. {
  341. if (::PathIsDirectory(a_strFolder))
  342. {
  343. return HasAttribute(a_strFolder, FILE_ATTRIBUTE_DIRECTORY);
  344. }
  345. return FALSE;
  346. }
  347. // check if the file or folder is read-only
  348. BOOL COTSFileSys::IsReadOnly(LPCTSTR a_strPathName)
  349. {
  350. return HasAttribute(a_strPathName, FILE_ATTRIBUTE_READONLY);
  351. }
  352. // sets the read-only flag for a file or a folder.
  353. BOOL COTSFileSys::SetReadOnly(LPCTSTR a_strPathName, BOOL a_bReadOnly /*=TRUE*/)
  354. {
  355. DWORD flags = GetFileAttributes(a_strPathName);
  356. if (a_bReadOnly)
  357. {
  358. flags |= FILE_ATTRIBUTE_READONLY;
  359. }
  360. else
  361. {
  362. flags &= ~FILE_ATTRIBUTE_READONLY;
  363. }
  364. return ::SetFileAttributes(a_strPathName, flags) != 0;
  365. }
  366. // get system common data folder pathname
  367. // return "" if failed
  368. CString COTSFileSys::GetOSCommonDataPathName()
  369. {
  370. CString strPathName= _T(".\\");
  371. return strPathName;
  372. }
  373. // get company system data path
  374. CString COTSFileSys::GetSysDataPathName()
  375. {
  376. // get common data pathname string
  377. CString strCommonDataPathName = COTSFileSys::GetOSCommonDataPathName();
  378. if (strCommonDataPathName.IsEmpty())
  379. {
  380. // failed to get common data pathname string
  381. LogErrorTrace(__FILE__, __LINE__, _T("GetOTSPackSysDataPathName: failed to common data pathname string."));
  382. return _T("");
  383. }
  384. // company system data pathname
  385. // e.g. "c:\ProgramData\OPTON\SysData\"
  386. CString strCmpSysDataPath = strCommonDataPathName + STR_COFIGPATH + _T("\\") + STR_SYSTEM_DATA + _T("\\");
  387. // return company system data pathname
  388. return strCmpSysDataPath;
  389. }
  390. // get company log pathname
  391. CString COTSFileSys::GetLogPathName()
  392. {
  393. // get common data pathname string
  394. CString strCommonDataPathName = COTSFileSys::GetOSCommonDataPathName();
  395. if (strCommonDataPathName.IsEmpty())
  396. {
  397. // failed to get company system data folder string
  398. LogErrorTrace(__FILE__, __LINE__, _T("GetCompayLogPathName: failed to common data pathname string."));
  399. return _T("");
  400. }
  401. // software package log path
  402. // e.g. "c:\ProgramData\Log\"
  403. CString strCompanyLogPathName = strCommonDataPathName + _T("\\") + STR_LOG + _T("\\");
  404. // return software package log path
  405. return strCompanyLogPathName;
  406. }
  407. // get software pack system data path
  408. CString COTSFileSys::GetOTSPackSysDataPathName(OTS_SOFT_PACKAGE_ID a_nPackId)//deprecated,since we have build one new solution for the particle system.
  409. {
  410. // get app package name
  411. CString strAppPackageName(_T(""));
  412. switch (a_nPackId)
  413. {
  414. case OTS_SOFT_PACKAGE_ID::OTSIncA:
  415. strAppPackageName = STR_APPNAME_OTSINCA;
  416. break;
  417. case OTS_SOFT_PACKAGE_ID::OTSPartA:
  418. strAppPackageName = STR_APPNAME_OTSINCA;
  419. break;
  420. default:
  421. LogErrorTrace(__FILE__, __LINE__, _T("GetOTSPackSysDataPathName: invalid software package id."));
  422. return _T("");
  423. }
  424. // get common data pathname string
  425. CString strCommonDataPathName = COTSFileSys::GetOSCommonDataPathName();
  426. if (strCommonDataPathName.IsEmpty())
  427. {
  428. // can't common data path
  429. LogErrorTrace(__FILE__, __LINE__, _T("GetOTSPackSysDataPathName: failed to common data path."));
  430. return _T("");
  431. }
  432. // software package system data pathname
  433. // e.g. "c:\ProgramData\OPTON\OTSIncA\SysData\"
  434. //CString strOTSSysDataPathName = strCommonDataPathName + STR_COFIGPATH + _T("\\") + strAppPackageName + _T("\\") + STR_SYSTEM_DATA + _T("\\");
  435. CString strOTSSysDataPathName = strCommonDataPathName + STR_COFIGPATH + _T("\\") + STR_SYSTEM_DATA + _T("\\");
  436. // return software package system data path
  437. return strOTSSysDataPathName;
  438. }
  439. // get software pack program data path
  440. CString COTSFileSys::GetOTSPackProgDataPathName(OTS_SOFT_PACKAGE_ID a_nPackId)
  441. {
  442. // get app package name
  443. CString strAppPackageName(_T(""));
  444. switch (a_nPackId)
  445. {
  446. case OTS_SOFT_PACKAGE_ID::OTSIncA:
  447. strAppPackageName = STR_APPNAME_OTSINCA;
  448. break;
  449. case OTS_SOFT_PACKAGE_ID::OTSPartA:
  450. strAppPackageName = STR_APPNAME_OTSINCA;
  451. break;
  452. default:
  453. LogErrorTrace(__FILE__, __LINE__, _T("GetOTSPackProgDataPathName: invalid software package id."));
  454. return _T("");
  455. }
  456. // get common data pathname string
  457. CString strCommonDataPathName = COTSFileSys::GetOSCommonDataPathName();
  458. if (strCommonDataPathName.IsEmpty())
  459. {
  460. // can't common data path
  461. LogErrorTrace(__FILE__, __LINE__, _T("GetOTSPackProgDataPathName: failed to common data path."));
  462. return _T("");
  463. }
  464. // software package program data pathname
  465. CString strOTSProDataPathName = strCommonDataPathName + STR_COFIGPATH + _T("\\") + STR_PROG_DATA + _T("\\");
  466. // return software package program data path
  467. return strOTSProDataPathName;
  468. }
  469. // get software pack preference file path name
  470. CString COTSFileSys::GetOTSPackMeasurePrefFilePathName(OTS_SOFT_PACKAGE_ID a_nPackId)
  471. {
  472. // get software package system data pathname
  473. CString strOTSPackSysDataPathName = COTSFileSys::GetOTSPackSysDataPathName(a_nPackId);
  474. // check if software package system data pathname is right
  475. if (strOTSPackSysDataPathName.IsEmpty())
  476. {
  477. // failed to get software package system data pathname
  478. LogErrorTrace(__FILE__, __LINE__, _T("GetOTSPackMeasurePrefFilePathName: failed to get software package system data path string."));
  479. return _T("");
  480. }
  481. // software package project manager file pathname
  482. // i.e. "c:\ProgramData\OPTON\OTSIncA\SysData\OTSProgMgrParam.pmf"
  483. CString strOTSPackProgMgrPathName = strOTSPackSysDataPathName + STR_MEASURE_PREFERENCE_FILE_NAME;
  484. // return software package license file pathname
  485. return strOTSPackProgMgrPathName;
  486. }
  487. // get software pack preference file path name
  488. CString COTSFileSys::GetOTSPackReportPrefFilePathName(OTS_SOFT_PACKAGE_ID a_nPackId)
  489. {
  490. // get software package system data pathname
  491. CString strOTSPackSysDataPathName = COTSFileSys::GetOTSPackSysDataPathName(a_nPackId);
  492. // check if software package system data pathname is right
  493. if (strOTSPackSysDataPathName.IsEmpty())
  494. {
  495. // failed to get software package system data pathname
  496. LogErrorTrace(__FILE__, __LINE__, _T("GetOTSPackMeasurePrefFilePathName: failed to get software package system data path string."));
  497. return _T("");
  498. }
  499. // software package project manager file pathname
  500. // i.e. "c:\ProgramData\OPTON\OTSIncA\SysData\OTSReportMgrParam.rp"
  501. CString strOTSPackProgMgrPathName = strOTSPackSysDataPathName + STR_REPORT_PREFERENCE_FILE_NAME;
  502. // return software package license file pathname
  503. return strOTSPackProgMgrPathName;
  504. }
  505. CString COTSFileSys::GetOTSPackSysSTDLibFilePathName(OTS_SOFT_PACKAGE_ID a_nPackId)
  506. {
  507. // get software package system data pathname
  508. CString strOTSPackSysDataPathName = COTSFileSys::GetOTSPackSysDataPathName(a_nPackId);
  509. // check if software package system data pathname is right
  510. if (strOTSPackSysDataPathName.IsEmpty())
  511. {
  512. // failed to get software package system data pathname
  513. LogErrorTrace(__FILE__, __LINE__, _T("GetOTSPackMeasurePrefFilePathName: failed to get software package system data path string."));
  514. return _T("");
  515. }
  516. CString strOTSPackSysSTDlibPathName;
  517. if(a_nPackId== OTS_SOFT_PACKAGE_ID::OTSIncA)
  518. { // software package project manager file pathname
  519. strOTSPackSysSTDlibPathName = strOTSPackSysDataPathName + SYS_STD_LIB_FILE_NAME;
  520. }
  521. else
  522. {
  523. strOTSPackSysSTDlibPathName = strOTSPackSysDataPathName + SYS_PartSTD_LIB_FILE_NAME;
  524. }
  525. // return software package license file pathname
  526. return strOTSPackSysSTDlibPathName;
  527. }
  528. }