MCPcopy Create free account
hub / github.com/Kitware/CMake / LoadPackageRegistryDir

Method LoadPackageRegistryDir

Source/cmFindPackageCommand.cxx:2719–2747  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2717
2718#else
2719void cmFindPackageCommand::LoadPackageRegistryDir(std::string const& dir,
2720 cmSearchPath& outPaths)
2721{
2722 cmsys::Directory files;
2723 if (!files.Load(dir)) {
2724 return;
2725 }
2726
2727 std::string fname;
2728 for (unsigned long i = 0; i < files.GetNumberOfFiles(); ++i) {
2729 fname = cmStrCat(dir, '/', files.GetFile(i));
2730
2731 if (!cmSystemTools::FileIsDirectory(fname)) {
2732 // Hold this file hostage until it behaves.
2733 cmFindPackageCommandHoldFile holdFile(fname.c_str());
2734
2735 // Load the file.
2736 cmsys::ifstream fin(fname.c_str(), std::ios::in | std::ios::binary);
2737 std::string fentry;
2738 if (fin && cmSystemTools::GetLineFromStream(fin, fentry) &&
2739 this->CheckPackageRegistryEntry(fentry, outPaths)) {
2740 // The file references an existing package, so release it.
2741 holdFile.Release();
2742 }
2743 }
2744 }
2745
2746 // TODO: Wipe out the directory if it is empty.
2747}
2748#endif
2749
2750bool cmFindPackageCommand::CheckPackageRegistryEntry(std::string const& fname,

Callers 1

Calls 5

c_strMethod · 0.80
cmStrCatFunction · 0.70
LoadMethod · 0.45
ReleaseMethod · 0.45

Tested by

no test coverage detected