Support/Path: Deprecate Path::hasMagicNumber and replace all uses with fs::has_magic.
llvm-svn: 122589
This commit is contained in:
parent
9d1419841a
commit
c581fe7e81
|
@ -329,7 +329,8 @@ namespace sys {
|
||||||
/// cases (file not found, file not accessible, etc.) it returns false.
|
/// cases (file not found, file not accessible, etc.) it returns false.
|
||||||
/// @returns true if the magic number of the file matches \p magic.
|
/// @returns true if the magic number of the file matches \p magic.
|
||||||
/// @brief Determine if file has a specific magic number
|
/// @brief Determine if file has a specific magic number
|
||||||
bool hasMagicNumber(StringRef magic) const;
|
LLVM_ATTRIBUTE_DEPRECATED(bool hasMagicNumber(StringRef magic) const,
|
||||||
|
LLVM_PATH_DEPRECATED_MSG(fs::has_magic));
|
||||||
|
|
||||||
/// This function retrieves the first \p len bytes of the file associated
|
/// This function retrieves the first \p len bytes of the file associated
|
||||||
/// with \p this. These bytes are returned as the "magic number" in the
|
/// with \p this. These bytes are returned as the "magic number" in the
|
||||||
|
|
|
@ -140,7 +140,11 @@ sys::IdentifyFileType(const char *magic, unsigned length) {
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Path::isArchive() const {
|
Path::isArchive() const {
|
||||||
return hasMagicNumber("!<arch>\012");
|
std::string Magic;
|
||||||
|
if (getMagicNumber(Magic, 8))
|
||||||
|
if (IdentifyFileType(Magic.c_str(), Magic.length()) == Archive_FileType)
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
Loading…
Reference in New Issue