namespace YLErp.Core.Helpers { /// /// 多操作系统文件路径支持 /// public static class MosPathHelper { /// /// Combines two strings into a path. /// /// The first path to combine. /// The second path to combine. /// public static string Combine(string path1, string path2) { if (!OperatingSystem.IsWindows()) { path1 = path1?.Replace('\\', '/'); path2 = path2?.Replace('\\', '/'); } return Path.Combine(path1, path2); } /// /// Combines an array of strings into a path. /// /// An array of parts of the path. /// public static string Combine(params string[] paths) { if (paths != null && !OperatingSystem.IsWindows()) { for (var i = 0; i < paths.Length; i++) { paths[i] = paths[i]?.Replace('\\', '/'); } } return Path.Combine(paths); } } }