4
4
// Created : 09-12-2021
5
5
//
6
6
// Last Modified By : Mario
7
- // Last Modified On : 07-05-2024
7
+ // Last Modified On : 06-26-2025
8
8
// ***********************************************************************
9
9
// <copyright file="PathOperations.cs" company="Mario">
10
10
// Mario
@@ -27,6 +27,23 @@ public static class PathOperations
27
27
{
28
28
#region Methods
29
29
30
+ /// <summary>
31
+ /// Gets the actual path casing.
32
+ /// </summary>
33
+ /// <param name="path">The path.</param>
34
+ /// <returns>System.String.</returns>
35
+ public static string GetActualPathCasing ( string path )
36
+ {
37
+ if ( ! File . Exists ( path ) && ! Directory . Exists ( path ) )
38
+ {
39
+ return path ;
40
+ }
41
+
42
+ var di = new DirectoryInfo ( path ) ;
43
+
44
+ return di . Parent != null ? Path . Combine ( GetActualPathCasing ( di . Parent . FullName ) , di . Parent . GetFileSystemInfos ( di . Name ) [ 0 ] . Name ) : di . Name . ToUpperInvariant ( ) ;
45
+ }
46
+
30
47
/// <summary>
31
48
/// Resolves the relative path.
32
49
/// </summary>
@@ -46,10 +63,10 @@ public static string ResolveRelativePath(string basePath, string path)
46
63
}
47
64
48
65
/// <summary>
49
- /// Pathes the contains relative segments.
66
+ /// Determines if path the contains relative segments.
50
67
/// </summary>
51
68
/// <param name="path">The path.</param>
52
- /// <returns><c>true</c> if XXXX , <c>false</c> otherwise.</returns>
69
+ /// <returns><c>true</c> if contains relative segment , <c>false</c> otherwise.</returns>
53
70
private static bool PathContainsRelativeSegments ( string path )
54
71
{
55
72
return path . StandardizeDirectorySeparator ( ) . Split ( Path . DirectorySeparatorChar ) . Any ( p => string . IsNullOrWhiteSpace ( p . Replace ( "." , string . Empty ) ) ) ;
0 commit comments