OTSFileSys.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #pragma once
  2. #include "otsdataconst.h"
  3. // COTSFileSys command target
  4. namespace OTSMODEL {
  5. using namespace OTSDATA;
  6. class __declspec(dllexport) COTSFileSys : private boost::noncopyable
  7. {
  8. public:
  9. COTSFileSys();
  10. ~COTSFileSys();
  11. // check if the file exists or not
  12. static BOOL Exists(LPCTSTR a_sPath);
  13. // check if the given string is valid file name or not
  14. static BOOL IsValidFileName(LPCTSTR a_sFileName);
  15. // copy a file
  16. static BOOL CopyAFile(LPCTSTR a_strSourceFile, LPCTSTR a_strTargetFile, const BOOL a_bOverwrite = FALSE);
  17. // move a file
  18. static BOOL MoveAFile(LPCTSTR a_strSourceFile, LPCTSTR a_strTargetFile, const BOOL a_bOverwrite = TRUE);
  19. // delete a file.
  20. static BOOL DeleteAFile(LPCTSTR a_strFileName);
  21. // delete all files in the folder
  22. static BOOL DeleteAllFiles(LPCTSTR a_strFolder, LPCTSTR a_sFilter = nullptr);
  23. // creates a folder.
  24. static BOOL CreateFolder(LPCTSTR a_strFolder);
  25. // deletes a folder and contents recursively.
  26. static BOOL DeleteFolder(LPCTSTR a_strFolder);
  27. // check if this is an existing folder
  28. static BOOL IsFolder(LPCTSTR a_strFolder);
  29. // check if the file or folder is read only
  30. static BOOL IsReadOnly(LPCTSTR a_strPathName);
  31. // sets the read only flag for a file or a folder
  32. static BOOL SetReadOnly(LPCTSTR a_strPathName, BOOL a_bReadOnly = TRUE);
  33. // get system common data folder pathname
  34. static CString GetOSCommonDataPathName();
  35. // get company system data pathname
  36. static CString GetCompanySysDataPathName();
  37. // get company log path
  38. static CString GetCompanyLogPathName();
  39. // get software pack system data path
  40. static CString GetOTSPackSysDataPathName(OTS_SOFT_PACKAGE_ID a_nPackId);
  41. // get software pack program data path
  42. static CString GetOTSPackProgDataPathName(OTS_SOFT_PACKAGE_ID a_nPackId);
  43. // get software pack measure preference file path name
  44. static CString GetOTSPackMeasurePrefFilePathName(OTS_SOFT_PACKAGE_ID a_nPackId);
  45. // get software pack measure preference file path name
  46. static CString GetOTSPackReportPrefFilePathName(OTS_SOFT_PACKAGE_ID a_nPackId);
  47. // get system STD lib file path name
  48. static CString GetOTSPackSysSTDLibFilePathName(OTS_SOFT_PACKAGE_ID a_nPackId);
  49. };
  50. }