source: dev/trunk/ab5.0/jenga/include/common/Path.h@ 749

Last change on this file since 749 was 749, checked in by dai, 16 years ago

「フォルダを開く」コマンドで、ファイル選択を可能にした。

File size: 1.4 KB
Line 
1#pragma once
2
3namespace Jenga{
4namespace Common{
5
6
7class 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
25public:
26 Path( const std::string &fullPath )
27 : fullPath( fullPath )
28 {
29 Expand();
30 }
31 ~Path()
32 {
33 }
34
35 bool IsExistFile() const;
36
37 const std::string &GetDriveName() const
38 {
39 return driveName;
40 }
41 const std::string GetDirPath() const
42 {
43 return driveName + 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 GetFullFileName() const
54 {
55 return fileName + ext;
56 }
57 const std::string &GetFullPath() const
58 {
59 return fullPath;
60 }
61 bool IsNetworkPath() const
62 {
63 if( fullPath.size() < 2 )
64 {
65 return false;
66 }
67 return ( ( fullPath[0] == '\\' ) && ( fullPath[1] == '\\' ) );
68 }
69
70 static std::string MakeFullPath( const std::string &relativePath, const std::string &baseDirPath );
71 static std::string MakeFullPathByCurrentDirectory( const std::string &relativePath );
72 static std::string ExtractDirPath( const std::string &path );
73};
74
75
76}}
Note: See TracBrowser for help on using the repository browser.