MCPcopy Create free account
hub / github.com/beefytech/Beef / AddFile

Method AddFile

IDEHelper/Linker/BlContext.cpp:1962–2004  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1960}
1961
1962bool BlContext::AddFile(const StringImpl& fileName, BlObjectDataKind objectDataKind)
1963{
1964 BL_AUTOPERF("BlContext::AddFile");
1965
1966 bool isLib = false;
1967 int dotPos = (int)fileName.LastIndexOf('.');
1968 if ((dotPos != -1) && (strncmp(fileName.c_str() + dotPos, ".lib", 4) == 0))
1969 {
1970 String lookupStr = FixPathAndCase(fileName);
1971 if (!mSeenLibs.insert(lookupStr).second)
1972 return true; // Already seen
1973 isLib = true;
1974 if (objectDataKind == BlObjectDataKind_SpecifiedObj)
1975 objectDataKind = BlObjectDataKind_SpecifiedLib;
1976 }
1977
1978 bool isAbsPath = (fileName.length() >= 2) &&
1979 ((fileName[0] == '/') || (fileName[0] == '\\') || (fileName[1] == ':'));
1980
1981 if (isAbsPath)
1982 {
1983 if (FileExists(fileName))
1984 return DoAddFile(fileName, objectDataKind);
1985 }
1986 else
1987 {
1988 String path;
1989 String actualFileName;
1990 for (auto& searchPath : mSearchPaths)
1991 {
1992 path = searchPath;
1993 path += fileName;
1994 if (FileExists(path, &actualFileName))
1995 {
1996 path = FixFilePath(path, actualFileName);
1997 return DoAddFile(path, objectDataKind);
1998 }
1999 }
2000 }
2001
2002 Fail(StrFormat("Unable to locate file: %s", fileName.c_str()));
2003 return false;
2004}
2005
2006void BlContext::PopulateIData_LookupTable(BlSegment* iDataSect, int& hintNameTableSize)
2007{

Callers 1

BlContext_AddFileFunction · 0.45

Calls 5

FixFilePathFunction · 0.85
FailFunction · 0.85
LastIndexOfMethod · 0.45
c_strMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected