Support/Path: Deprecate PathV1::isDirectory and replace all uses with PathV2::is_directory.

llvm-svn: 123209
This commit is contained in:
Michael J. Spencer 2011-01-11 01:21:55 +00:00
parent e503f89b4b
commit 0d771edeee
4 changed files with 23 additions and 4 deletions

View File

@ -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.

View File

@ -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;
}

View 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");

View File

@ -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