// /** // * File: PathHelper.cs // * Author: haraldwolff // * // * This file and it's content is copyrighted by the Author and / or copyright holder. // * Any use wihtout proper permission is illegal and may lead to legal actions. // * // * // **/ using System; using System.Collections.Generic; using System.Collections; using System.IO; namespace ln.types { public static class PathHelper { public static string FindPath(params string[] search) => FindPath((IEnumerable)search); public static string FindPath(IEnumerable search) { foreach (string p in search) { if (Directory.Exists(p) || File.Exists(p)) return Path.GetFullPath(p); } return null; } public static string FindDirectory(params string[] search) => FindPath((IEnumerable)search); public static string FindDirectory(IEnumerable search) { foreach (string p in search) { if (Directory.Exists(p)) return Path.GetFullPath(p); } return null; } public static string FindFile(string filename, params string[] search) => FindFile(filename, (IEnumerable)search); public static string FindFile(string filename, IEnumerable search) { foreach (string p in search) { String path = Path.Combine(p, filename); if (File.Exists(path)) return path; } return null; } } }