mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 20:32:21 +00:00
UnRevert "Revert the archive part of "Support/PathV2: Add identify_magic.""
This reverts commit dd103021a8
.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123595 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
6990433b56
commit
3c98e14bc9
@ -116,11 +116,10 @@ bool ArchiveMember::replaceWith(const sys::Path& newFile, std::string* ErrMsg) {
|
||||
|
||||
// Get the signature and status info
|
||||
const char* signature = (const char*) data;
|
||||
std::string magic;
|
||||
SmallString<4> magic;
|
||||
if (!signature) {
|
||||
path.getMagicNumber(magic,4);
|
||||
sys::fs::get_magic(path.str(), magic.capacity(), magic);
|
||||
signature = magic.c_str();
|
||||
std::string err;
|
||||
const sys::FileStatus *FSinfo = path.getFileStatus(false, ErrMsg);
|
||||
if (FSinfo)
|
||||
info = *FSinfo;
|
||||
|
@ -181,9 +181,11 @@ Archive::addFileBefore(const sys::Path& filePath, iterator where,
|
||||
flags |= ArchiveMember::HasPathFlag;
|
||||
if (hasSlash || filePath.str().length() > 15)
|
||||
flags |= ArchiveMember::HasLongFilenameFlag;
|
||||
std::string magic;
|
||||
mbr->path.getMagicNumber(magic,4);
|
||||
switch (sys::IdentifyFileType(magic.c_str(),4)) {
|
||||
|
||||
sys::LLVMFileType type;
|
||||
if (sys::fs::identify_magic(mbr->path.str(), type))
|
||||
type = sys::Unknown_FileType;
|
||||
switch (type) {
|
||||
case sys::Bitcode_FileType:
|
||||
flags |= ArchiveMember::BitcodeFlag;
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user