OTSFileSys.h 2.3 KB

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