Rev | Line | |
---|
[286] | 1 | #pragma once
|
---|
| 2 |
|
---|
| 3 | namespace Jenga{
|
---|
| 4 | namespace Common{
|
---|
| 5 |
|
---|
| 6 |
|
---|
| 7 | class Path
|
---|
| 8 | {
|
---|
| 9 | std::string fullPath;
|
---|
| 10 | std::string driveName;
|
---|
| 11 | std::string dirName;
|
---|
| 12 | std::string fileName;
|
---|
| 13 | std::string ext;
|
---|
| 14 |
|
---|
| 15 | void Expand()
|
---|
| 16 | {
|
---|
| 17 | char szDrive[32], szDir[1024], szFile[1024], szExt[255];
|
---|
| 18 | _splitpath_s( fullPath.c_str(), szDrive, 32, szDir, 1024, szFile, 1024, szExt, 255 );
|
---|
| 19 | driveName = szDrive;
|
---|
| 20 | dirName = szDir;
|
---|
| 21 | fileName = szFile;
|
---|
| 22 | ext = szExt;
|
---|
| 23 | }
|
---|
| 24 |
|
---|
| 25 | public:
|
---|
| 26 | Path( const std::string &fullPath )
|
---|
| 27 | : fullPath( fullPath )
|
---|
| 28 | {
|
---|
| 29 | Expand();
|
---|
| 30 | }
|
---|
| 31 | ~Path()
|
---|
| 32 | {
|
---|
| 33 | }
|
---|
| 34 |
|
---|
[314] | 35 | bool IsExistFile() const;
|
---|
[286] | 36 |
|
---|
| 37 | const std::string &GetDriveName() const
|
---|
| 38 | {
|
---|
| 39 | return driveName;
|
---|
| 40 | }
|
---|
| 41 | const std::string &GetDirName() const
|
---|
| 42 | {
|
---|
| 43 | return dirName;
|
---|
| 44 | }
|
---|
| 45 | const std::string &GetFileName() const
|
---|
| 46 | {
|
---|
| 47 | return fileName;
|
---|
| 48 | }
|
---|
| 49 | const std::string &GetExt() const
|
---|
| 50 | {
|
---|
| 51 | return ext;
|
---|
| 52 | }
|
---|
| 53 | const std::string &GetFullPath() const
|
---|
| 54 | {
|
---|
| 55 | return fullPath;
|
---|
| 56 | }
|
---|
[467] | 57 |
|
---|
| 58 | static std::string MakeFullPath( const std::string &relativePath, const std::string &baseDirPath );
|
---|
[480] | 59 | static std::string MakeFullPathByCurrentDirectory( const std::string &relativePath );
|
---|
[286] | 60 | };
|
---|
| 61 |
|
---|
| 62 |
|
---|
| 63 | }}
|
---|
Note:
See
TracBrowser
for help on using the repository browser.