| 2717 | |
| 2718 | #else |
| 2719 | void 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 | |
| 2750 | bool cmFindPackageCommand::CheckPackageRegistryEntry(std::string const& fname, |
no test coverage detected