![]() ![]() ![]()
|
BREW C++ Class Library & GUI Framework & XML Middleware : SophiaFramework 4.1 |
SFXPath is the class for operating a file path. The arguments of file path specified in the functions of SFXFile and SFXDirectory classes are of SFXPath type.
In the above example, the argument ending with the separator ('/') character represents a directory. A file name dose not end with the separator ('/') character.
Example 15.23. Check whether it is a directory or not
if (path.IsDirectory()) {
// when path denotes a directory
}
if (path.IsRootDirectory()) {
// when path denotes a root directory
}
if (path.IsHomeDirectory()) {
// when path denotes a home directory
}
![]() |
Note |
|---|---|
| The SFXPath::IsDirectory function returns false if path is "/dir1/data.txt", while it returns true if path is "/dir1/dir2/". The path string is used to check regardless of the file existence. | |
Example 15.24. Get the parent directory
SFXPath path1("/dir1/dir2/data.txt");
SFXPath path2;
SFXAnsiString string;
// path2 is "/dir1/dir2/", path1 is not changed
path2 = path1.GetParentPath();
// this function returns a string
string = path1.GetParent();
There are two functions: one is a function returning the SFXPath instance, and the other is a function returning the SFXAnsiString instance.
Example 15.25. Get the absolute path
SFXPath path1("dir1/dir2/data.txt");
SFXPath path2;
// path2 = "/dir1/dir2/data.txt"
// path1 is not changed
path2 = path1.GetAbsolutePath();
![]() |
Root path |
|---|---|
|
The root path varies according to the BREW versions. BREW 2.x is "/", BREW 3.x is "fs:/" | |
|
Copyright (C) 2002 - 2008 Sophia Cradle, Inc. All Rights Reserved. |
![]() ![]() ![]()
|