29 #include YFM_YSLib_Service_FileSystem
31 #include <system_error>
44 auto&
norm(get_norm());
46 if(
norm.is_parent(fname))
48 if((is_absolute() ? 1 : 0) < size())
51 else if(!
norm.is_self(fname))
58 for(
const auto& fname : pth)
65 auto res(GetString());
73 Path::GetString()
const
75 const auto res(ystdex::to_string_d(static_cast<const ypath&>(*
this),
78 YAssert(res.empty() || res.back() == YCL_PATH_DELIMITER,
79 "Invalid conversion result found.");
91 }, [&](ucs2string::const_iterator b, ucs2string::const_iterator e){
103 const auto pos(fname.rfind(
'.'));
105 if(pos != String::npos)
106 return fname.substr(pos + 1);
142 for(
const auto&
name : pth)
144 upath +=
strdup(
name.c_str(), CS_Path) + YCL_PATH_DELIMITER;
145 if(!
umkdir(upath.c_str()) && errno != EEXIST)
146 throw std::system_error(errno, std::system_category());
165 ? name + YCL_PATH_DELIMITER :
name, CS_Path));
177 return PathCategory::Empty;
178 if(norm.is_self(fname))
179 return PathCategory::Self;
180 if(norm.is_parent(fname))
181 return PathCategory::Parent;
182 return PathCategory::Node;
189 return NodeCategory::Empty;
191 const auto& fname(pth.back());
195 case PathCategory::Empty:
196 return NodeCategory::Empty;
197 case PathCategory::Self:
198 case PathCategory::Parent:
203 ? NodeCategory::Directory : NodeCategory::Regular;
205 return NodeCategory::Missing;
208 return NodeCategory::Unknown;
char16_t * u16getcwd_n(char16_t *buf, std::size_t size) ynothrow
YF_API std::string strdup(const ucs2_t *, Encoding=CS_Default)
复制 UCS-2 字符串为多字节字符串。
void ListFiles(const Path &pth, vector< String > &lst)
YF_API bool ufexists(const char *) ynothrow
判断指定 UTF-8 文件名的文件是否存在。
bool VerifyDirectory(const char *path)
PathCategory ClassifyPath(const String &fname, ypath::norm &&norm)
void split(_tIn b, _tIn e, _fPred is_delim, _fInsert insert)
以指定字符分割字符序列。
String FetchCurrentWorkingDirectory(size_t len)
GSStringTemplate< CHRLib::ucs2_t >::basic_string ucs2string
String GetExtensionOf(const String &fname)
#define YB_UNLIKELY(expr)
分支预测提示。
YSLib 标准字符串(使用 UCS-2 作为内部编码)。
yconstfn const string & name
GSStringTemplate< char >::basic_string string
void EnsureDirectory(const Path &pth)
NodeCategory GetNodeCategory() const ynothrow
取节点状态信息确定的文件系统节点类别。
ystdex::indirect_input_iterator< HDirectory * > FileIterator
文件迭代器。
YF_API bool umkdir(const char *) ynothrow
按 UTF-8 路径以默认权限新建一个目录。
virtual bool is_self(const value_type &)=0
Path & operator/=(const Path &)
char16_t ucs2_t
UCS-2 字符类型。
virtual bool is_parent(const value_type &)=0
#define YAssert(_expr, _msg)
YF_API NodeCategory ClassifyNode(const Path &)
按文件系统节点类别对路径分类。