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. // ok, return TRUE
  217. return TRUE;
  218. }
  219. // creates a folder.
  220. BOOL COTSFileSys::CreateFolder(LPCTSTR a_strFolder)
  221. {
  222. // make sure the folder name string are not empty
  223. CString strFolder = a_strFolder;
  224. strFolder.Trim();
  225. if (strFolder.IsEmpty())
  226. {
  227. LogErrorTrace(__FILE__, __LINE__, "CreateFolder: invalid folder name is empty.");
  228. return FALSE;
  229. }
  230. // if the folder exist?
  231. if (Exists(strFolder))
  232. {
  233. // is a real folder?
  234. if (IsFolder(strFolder))
  235. {
  236. return TRUE;
  237. }
  238. }
  239. // create folder
  240. // remove back slash if there
  241. CString strParentFolder = strFolder;
  242. strParentFolder.Trim(_T("\\"));
  243. // find last back slash position
  244. int nBackSlashPos = strParentFolder.ReverseFind(_T('\\'));
  245. if (nBackSlashPos > 0)
  246. {
  247. // get the folder name
  248. CString strFolderName = strParentFolder.Right(strParentFolder.GetLength() - nBackSlashPos - 1);
  249. // separate the folder string
  250. strParentFolder = strParentFolder.Left(nBackSlashPos);
  251. if (!IsValidFileName(strFolderName))
  252. {
  253. LogErrorTrace(__FILE__, __LINE__, "CreateFolder: invalid folder or file name %s.", strFolderName);
  254. return FALSE;
  255. }
  256. // try to create folder from the base folder
  257. if (!CreateFolder(strParentFolder))
  258. {
  259. LogErrorTrace(__FILE__, __LINE__, "CreateFolder: failed to create %s folder.", strParentFolder);
  260. return FALSE;
  261. }
  262. }
  263. // create the folder
  264. BOOL bRet = ::CreateDirectory(strFolder, NULL) == TRUE;
  265. // return folder create result
  266. return bRet;
  267. }
  268. // deletes a folder and contents recursively.
  269. BOOL COTSFileSys::DeleteFolder(LPCTSTR a_strFolder)
  270. {
  271. // make sure the folder name string are not empty
  272. CString strFolder = a_strFolder;
  273. strFolder.Trim();
  274. if (strFolder.IsEmpty())
  275. {
  276. LogErrorTrace(__FILE__, __LINE__, _T("CreateFolder: invalid folder name is empty."));
  277. return FALSE;
  278. }
  279. // quit if the folder is not exist
  280. if (!Exists(strFolder))
  281. {
  282. LogErrorTrace(__FILE__, __LINE__, _T("DeleteFolder: %s folder is not exist."), strFolder);
  283. return TRUE;
  284. }
  285. // make sure it is a folder
  286. if (!IsFolder(strFolder))
  287. {
  288. LogErrorTrace(__FILE__, __LINE__, _T("DeleteFolder: %s is a folder."), strFolder);
  289. return FALSE;
  290. }
  291. // readonly?
  292. if (!IsReadOnly(strFolder))
  293. {
  294. LogErrorTrace(__FILE__, __LINE__, _T("DeleteFolder: %s folder is readonly."), strFolder);
  295. return FALSE;
  296. }
  297. // remove every thing in the folder
  298. CFileFind fileSearch;
  299. CString filePattern(strFolder);
  300. filePattern += _T("\\*.*");
  301. BOOL ret = fileSearch.FindFile(filePattern);
  302. while (ret)
  303. {
  304. // get a file or a folder
  305. ret = fileSearch.FindNextFile();
  306. // jump over if this is a dots item
  307. if (fileSearch.IsDots())
  308. {
  309. continue;
  310. }
  311. // is a sub folder
  312. if (fileSearch.IsDirectory())
  313. {
  314. // delete the sub folder
  315. if (!DeleteFolder(fileSearch.GetFilePath()))
  316. {
  317. LogErrorTrace(__FILE__, __LINE__, _T("DeleteFolder: delete %s sub folder failed."), fileSearch.GetFilePath());
  318. return FALSE;
  319. }
  320. }
  321. // or a file, delete the file
  322. else if (!DeleteAFile(fileSearch.GetFilePath()))
  323. {
  324. LogErrorTrace(__FILE__, __LINE__, _T("DeleteFolder: delete %s file failed."), fileSearch.GetFilePath());
  325. return FALSE;
  326. }
  327. }
  328. // delete the folderstrFolder
  329. if (!::RemoveDirectory(a_strFolder))
  330. {
  331. LogErrorTrace(__FILE__, __LINE__, _T("DeleteFolder: remove directory %s failed."), strFolder);
  332. return FALSE;
  333. }
  334. // ok return TRUE
  335. return TRUE;
  336. }
  337. // check if this is an existing folder
  338. BOOL COTSFileSys::IsFolder(LPCTSTR a_strFolder)
  339. {
  340. if (::PathIsDirectory(a_strFolder))
  341. {
  342. return HasAttribute(a_strFolder, FILE_ATTRIBUTE_DIRECTORY);
  343. }
  344. return FALSE;
  345. }
  346. // check if the file or folder is read-only
  347. BOOL COTSFileSys::IsReadOnly(LPCTSTR a_strPathName)
  348. {
  349. return HasAttribute(a_strPathName, FILE_ATTRIBUTE_READONLY);
  350. }
  351. // sets the read-only flag for a file or a folder.
  352. BOOL COTSFileSys::SetReadOnly(LPCTSTR a_strPathName, BOOL a_bReadOnly /*=TRUE*/)
  353. {
  354. DWORD flags = GetFileAttributes(a_strPathName);
  355. if (a_bReadOnly)
  356. {
  357. flags |= FILE_ATTRIBUTE_READONLY;
  358. }
  359. else
  360. {
  361. flags &= ~FILE_ATTRIBUTE_READONLY;
  362. }
  363. return ::SetFileAttributes(a_strPathName, flags) != 0;
  364. }
  365. // get system common data folder pathname
  366. // return "" if failed
  367. CString COTSFileSys::GetOSCommonDataPathName()
  368. {
  369. CString strPathName= _T(".\\");
  370. return strPathName;
  371. }
  372. // get company system data path
  373. CString COTSFileSys::GetSysDataPathName()
  374. {
  375. // get common data pathname string
  376. CString strCommonDataPathName = COTSFileSys::GetOSCommonDataPathName();
  377. if (strCommonDataPathName.IsEmpty())
  378. {
  379. // failed to get common data pathname string
  380. LogErrorTrace(__FILE__, __LINE__, _T("GetOTSPackSysDataPathName: failed to common data pathname string."));
  381. return _T("");
  382. }
  383. // company system data pathname
  384. // e.g. "c:\ProgramData\OPTON\SysData\"
  385. CString strCmpSysDataPath = strCommonDataPathName + STR_COFIGPATH + _T("\\") + STR_SYSTEM_DATA + _T("\\");
  386. // return company system data pathname
  387. return strCmpSysDataPath;
  388. }
  389. // get company log pathname
  390. CString COTSFileSys::GetLogPathName()
  391. {
  392. // get common data pathname string
  393. CString strCommonDataPathName = COTSFileSys::GetOSCommonDataPathName();
  394. if (strCommonDataPathName.IsEmpty())
  395. {
  396. // failed to get company system data folder string
  397. LogErrorTrace(__FILE__, __LINE__, _T("GetCompayLogPathName: failed to common data pathname string."));
  398. return _T("");
  399. }
  400. // software package log path
  401. // e.g. "c:\ProgramData\Log\"
  402. CString strCompanyLogPathName = strCommonDataPathName + _T("\\") + STR_LOG + _T("\\");
  403. // return software package log path
  404. return strCompanyLogPathName;
  405. }
  406. // get software pack system data path
  407. CString COTSFileSys::GetOTSPackSysDataPathName(OTS_SOFT_PACKAGE_ID a_nPackId)//deprecated,since we have build one new solution for the particle system.
  408. {
  409. // get app package name
  410. CString strAppPackageName(_T(""));
  411. switch (a_nPackId)
  412. {
  413. case OTS_SOFT_PACKAGE_ID::OTSIncA:
  414. strAppPackageName = STR_APPNAME_OTSINCA;
  415. break;
  416. case OTS_SOFT_PACKAGE_ID::OTSPartA:
  417. strAppPackageName = STR_APPNAME_OTSINCA;
  418. break;
  419. default:
  420. LogErrorTrace(__FILE__, __LINE__, _T("GetOTSPackSysDataPathName: invalid software package id."));
  421. return _T("");
  422. }
  423. // get common data pathname string
  424. CString strCommonDataPathName = COTSFileSys::GetOSCommonDataPathName();
  425. if (strCommonDataPathName.IsEmpty())
  426. {
  427. // can't common data path
  428. LogErrorTrace(__FILE__, __LINE__, _T("GetOTSPackSysDataPathName: failed to common data path."));
  429. return _T("");
  430. }
  431. // software package system data pathname
  432. // e.g. "c:\ProgramData\OPTON\OTSIncA\SysData\"
  433. //CString strOTSSysDataPathName = strCommonDataPathName + STR_COFIGPATH + _T("\\") + strAppPackageName + _T("\\") + STR_SYSTEM_DATA + _T("\\");
  434. CString strOTSSysDataPathName = strCommonDataPathName + STR_COFIGPATH + _T("\\") + STR_SYSTEM_DATA + _T("\\");
  435. // return software package system data path
  436. return strOTSSysDataPathName;
  437. }
  438. // get software pack program data path
  439. CString COTSFileSys::GetOTSPackProgDataPathName(OTS_SOFT_PACKAGE_ID a_nPackId)
  440. {
  441. // get app package name
  442. CString strAppPackageName(_T(""));
  443. switch (a_nPackId)
  444. {
  445. case OTS_SOFT_PACKAGE_ID::OTSIncA:
  446. strAppPackageName = STR_APPNAME_OTSINCA;
  447. break;
  448. case OTS_SOFT_PACKAGE_ID::OTSPartA:
  449. strAppPackageName = STR_APPNAME_OTSINCA;
  450. break;
  451. default:
  452. LogErrorTrace(__FILE__, __LINE__, _T("GetOTSPackProgDataPathName: invalid software package id."));
  453. return _T("");
  454. }
  455. // get common data pathname string
  456. CString strCommonDataPathName = COTSFileSys::GetOSCommonDataPathName();
  457. if (strCommonDataPathName.IsEmpty())
  458. {
  459. // can't common data path
  460. LogErrorTrace(__FILE__, __LINE__, _T("GetOTSPackProgDataPathName: failed to common data path."));
  461. return _T("");
  462. }
  463. // software package program data pathname
  464. CString strOTSProDataPathName = strCommonDataPathName + STR_COFIGPATH + _T("\\") + STR_PROG_DATA + _T("\\");
  465. // return software package program data path
  466. return strOTSProDataPathName;
  467. }
  468. // get software pack preference file path name
  469. CString COTSFileSys::GetOTSPackMeasurePrefFilePathName(OTS_SOFT_PACKAGE_ID a_nPackId)
  470. {
  471. // get software package system data pathname
  472. CString strOTSPackSysDataPathName = COTSFileSys::GetOTSPackSysDataPathName(a_nPackId);
  473. // check if software package system data pathname is right
  474. if (strOTSPackSysDataPathName.IsEmpty())
  475. {
  476. // failed to get software package system data pathname
  477. LogErrorTrace(__FILE__, __LINE__, _T("GetOTSPackMeasurePrefFilePathName: failed to get software package system data path string."));
  478. return _T("");
  479. }
  480. // software package project manager file pathname
  481. // i.e. "c:\ProgramData\OPTON\OTSIncA\SysData\OTSProgMgrParam.pmf"
  482. CString strOTSPackProgMgrPathName = strOTSPackSysDataPathName + STR_MEASURE_PREFERENCE_FILE_NAME;
  483. // return software package license file pathname
  484. return strOTSPackProgMgrPathName;
  485. }
  486. // get software pack preference file path name
  487. CString COTSFileSys::GetOTSPackReportPrefFilePathName(OTS_SOFT_PACKAGE_ID a_nPackId)
  488. {
  489. // get software package system data pathname
  490. CString strOTSPackSysDataPathName = COTSFileSys::GetOTSPackSysDataPathName(a_nPackId);
  491. // check if software package system data pathname is right
  492. if (strOTSPackSysDataPathName.IsEmpty())
  493. {
  494. // failed to get software package system data pathname
  495. LogErrorTrace(__FILE__, __LINE__, _T("GetOTSPackMeasurePrefFilePathName: failed to get software package system data path string."));
  496. return _T("");
  497. }
  498. // software package project manager file pathname
  499. // i.e. "c:\ProgramData\OPTON\OTSIncA\SysData\OTSReportMgrParam.rp"
  500. CString strOTSPackProgMgrPathName = strOTSPackSysDataPathName + STR_REPORT_PREFERENCE_FILE_NAME;
  501. // return software package license file pathname
  502. return strOTSPackProgMgrPathName;
  503. }
  504. CString COTSFileSys::GetOTSPackSysSTDLibFilePathName(OTS_SOFT_PACKAGE_ID a_nPackId)
  505. {
  506. // get software package system data pathname
  507. CString strOTSPackSysDataPathName = COTSFileSys::GetOTSPackSysDataPathName(a_nPackId);
  508. // check if software package system data pathname is right
  509. if (strOTSPackSysDataPathName.IsEmpty())
  510. {
  511. // failed to get software package system data pathname
  512. LogErrorTrace(__FILE__, __LINE__, _T("GetOTSPackMeasurePrefFilePathName: failed to get software package system data path string."));
  513. return _T("");
  514. }
  515. CString strOTSPackSysSTDlibPathName;
  516. if(a_nPackId== OTS_SOFT_PACKAGE_ID::OTSIncA)
  517. { // software package project manager file pathname
  518. strOTSPackSysSTDlibPathName = strOTSPackSysDataPathName + SYS_STD_LIB_FILE_NAME;
  519. }
  520. else
  521. {
  522. strOTSPackSysSTDlibPathName = strOTSPackSysDataPathName + SYS_PartSTD_LIB_FILE_NAME;
  523. }
  524. // return software package license file pathname
  525. return strOTSPackSysSTDlibPathName;
  526. }
  527. }