diff --git a/VSTabPath/TabTitleManager.cs b/VSTabPath/TabTitleManager.cs index 2256a5c..a131ec4 100644 --- a/VSTabPath/TabTitleManager.cs +++ b/VSTabPath/TabTitleManager.cs @@ -86,11 +86,11 @@ private void InstallTabTitlePath(DocumentView view) if (!(bindingExpression?.DataItem is WindowFrame frame)) return; - var model = new TabModel(frame.FrameMoniker.Filename); + var model = new TabModel(FixFileNameCase(frame.FrameMoniker.Filename)); frame.PropertyChanged += (sender, args) => { if (args.PropertyName == nameof(WindowFrame.AnnotatedTitle)) - model.FullPath = frame.FrameMoniker.Filename; + model.FullPath = FixFileNameCase(frame.FrameMoniker.Filename); }; _displayPathResolver.Add(model); @@ -121,5 +121,21 @@ private static TProperty EnsurePropertyValue(T target, DependencyP } return value; } + + private static string FixFileNameCase(string fileName) + { + try + { + var pathParts = fileName.Split(Path.DirectorySeparatorChar); + var fixedPath = pathParts[0].ToUpperInvariant() + "\\"; + for (var i = 1; i < pathParts.Length; i++) + fixedPath = Directory.GetFileSystemEntries(fixedPath, pathParts[i])[0]; + return fixedPath; + } + catch + { + return fileName; + } + } } } \ No newline at end of file