+// Returns FALSE if the specified file/volume matches the GlobalConfig.DontScanDirs
+// or GlobalConfig.DontScanVolumes specification, or if Path points to a volume
+// other than the one specified by Volume. Returns TRUE if none of these conditions
+// is met -- that is, if the path is eligible for scanning. Also reduces *Path to a
+// path alone, with no volume specification.
+static BOOLEAN ShouldScan(REFIT_VOLUME *Volume, CHAR16 *Path) {
+ CHAR16 *VolName = NULL, *DontScanDir;
+ UINTN i = 0, VolNum;
+ BOOLEAN ScanIt = TRUE;
+
+ if (IsIn(Volume->VolName, GlobalConfig.DontScanVolumes))
+ return FALSE;
+
+ while ((DontScanDir = FindCommaDelimited(GlobalConfig.DontScanDirs, i++)) && ScanIt) {
+ SplitVolumeAndFilename(&DontScanDir, &VolName);
+ CleanUpPathNameSlashes(DontScanDir);
+ if (VolName != NULL) {
+ if ((StriCmp(VolName, Volume->VolName) == 0) && (StriCmp(DontScanDir, Path) == 0))
+ ScanIt = FALSE;
+ if ((StrLen(VolName) > 2) && (VolName[0] == L'f') && (VolName[1] == L's') && (VolName[2] >= L'0') && (VolName[2] <= L'9')) {
+ VolNum = Atoi(VolName + 2);
+ if ((VolNum == Volume->VolNumber) && (StriCmp(DontScanDir, Path) == 0))
+ ScanIt = FALSE;
+ }
+ } else {
+ if (StriCmp(DontScanDir, Path) == 0)
+ ScanIt = FALSE;
+ }
+ MyFreePool(DontScanDir);
+ DontScanDir = NULL;
+ }
+ return ScanIt;
+} // BOOLEAN ShouldScan()
+