mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-14 07:31:53 +00:00
Support/Path: Deprecate PathV1::isDirectory and replace all uses with PathV2::is_directory.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123209 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
121704d738
commit
218dc3e2fe
@ -387,7 +387,8 @@ namespace sys {
|
||||
/// 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.
|
||||
|
@ -636,10 +636,26 @@ bool is_directory(file_status status) {
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -823,7 +823,8 @@ Path::makeUnique(bool reuse_current, std::string* ErrMsg) {
|
||||
Buf.resize(path.size()+8);
|
||||
char *FNBuffer = &Buf[0];
|
||||
path.copy(FNBuffer,path.size());
|
||||
if (isDirectory())
|
||||
bool isdir;
|
||||
if (!fs::is_directory(path, isdir) && isdir)
|
||||
strcpy(FNBuffer+path.size(), "/XXXXXX");
|
||||
else
|
||||
strcpy(FNBuffer+path.size(), "-XXXXXX");
|
||||
|
@ -410,9 +410,10 @@ Path::canExecute() const {
|
||||
|
||||
bool
|
||||
Path::isRegularFile() const {
|
||||
if (isDirectory())
|
||||
bool res;
|
||||
if (fs::is_regular_file(path, res))
|
||||
return false;
|
||||
return true;
|
||||
return res;
|
||||
}
|
||||
|
||||
StringRef
|
||||
|
Loading…
Reference in New Issue
Block a user