git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123209
91177308-0d34-0410-b5e6-
96231b3b80d8
/// existing directory.
/// @returns true if the pathname references an existing directory.
/// @brief Determines if the path is a directory in the file system.
/// existing directory.
/// @returns true if the pathname references an existing directory.
/// @brief Determines if the path is a directory in the file system.
- bool isDirectory() const;
+ LLVM_ATTRIBUTE_DEPRECATED(bool isDirectory() const,
+ LLVM_PATH_DEPRECATED_MSG(fs::is_directory));
/// This function determines if the path name references an
/// existing symbolic link.
/// This function determines if the path name references an
/// existing symbolic link.
return status.type() == file_type::directory_file;
}
return status.type() == file_type::directory_file;
}
+error_code is_directory(const Twine &path, bool &result) {
+ file_status st;
+ if (error_code ec = status(path, st))
+ return ec;
+ result = is_directory(st);
+ return success;
+}
+
bool is_regular_file(file_status status) {
return status.type() == file_type::regular_file;
}
bool is_regular_file(file_status status) {
return status.type() == file_type::regular_file;
}
+error_code is_regular_file(const Twine &path, bool &result) {
+ file_status st;
+ if (error_code ec = status(path, st))
+ return ec;
+ result = is_regular_file(st);
+ return success;
+}
+
bool is_symlink(file_status status) {
return status.type() == file_type::symlink_file;
}
bool is_symlink(file_status status) {
return status.type() == file_type::symlink_file;
}
Buf.resize(path.size()+8);
char *FNBuffer = &Buf[0];
path.copy(FNBuffer,path.size());
Buf.resize(path.size()+8);
char *FNBuffer = &Buf[0];
path.copy(FNBuffer,path.size());
+ bool isdir;
+ if (!fs::is_directory(path, isdir) && isdir)
strcpy(FNBuffer+path.size(), "/XXXXXX");
else
strcpy(FNBuffer+path.size(), "-XXXXXX");
strcpy(FNBuffer+path.size(), "/XXXXXX");
else
strcpy(FNBuffer+path.size(), "-XXXXXX");
bool
Path::isRegularFile() const {
bool
Path::isRegularFile() const {
+ bool res;
+ if (fs::is_regular_file(path, res))