protected List<LibrarySearchPath> getLibrarySearchPaths(Program program, LoadSpec loadSpec,
			List<Option> options, MessageLog log, TaskMonitor monitor) throws CancelledException {
		if (!isLoadLibraries(options) && !shouldSearchAllPaths(program, options, log)) {
			return List.of();
		}

		FileSystemService fsService = FileSystemService.getInstance();
		List<LibrarySearchPath> result = new ArrayList<>();
		boolean success = false;
		try {
			for (FSRL fsrl : LibrarySearchPathManager.getLibraryFsrlList(program, log, monitor)) {

				if (!isValidSearchPath(fsrl, loadSpec, monitor)) {
					continue;
				}

				if (fsService.isLocal(fsrl)) {
					try {
						FileSystemRef fileRef =
							fsService.probeFileForFilesystem(fsrl, monitor, null);
						if (fileRef != null) {
							result.add(new LibrarySearchPath(fileRef, null));
						}
					}
					catch (IOException e) {
						log.appendMsg(e.getMessage());
					}
				}
				else {
					try (RefdFile fileRef = fsService.getRefdFile(fsrl, monitor)) {
						if (fileRef != null) {
							File f = new File(fileRef.file.getPath()); // File API will sanitize Windows-style paths
							result.add(new LibrarySearchPath(fileRef.fsRef.dup(), f.getPath()));
						}
					}
					catch (IOException e) {
						log.appendMsg(e.getMessage());
					}
				}
			}
			success = true;
		}
		finally {
			if (!success) {
				result.forEach(fsSearchPath -> fsSearchPath.fsRef().close());
			}
		}
		return result;
	}
Gets a {@link List} of priority-ordered {@link LibrarySearchPath}s used to search for 
libraries

@param program The {@link Program} being loaded
@param loadSpec The {@link LoadSpec} to use during load
@param options The options
@param log The log
@param monitor A cancelable task monitor
@return A {@link List} of priority-ordered {@link LibrarySearchPath}s used to search for 
  libraries
@throws CancelledException if the user cancelled the load
Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/AbstractLibrarySupportLoader.java