Skip to content

Commit 5faf986

Browse files
committed
Show paths with correct casing.
1 parent e44c57f commit 5faf986

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

VSTabPath/TabTitleManager.cs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,11 @@ private void InstallTabTitlePath(DocumentView view)
8686
if (!(bindingExpression?.DataItem is WindowFrame frame))
8787
return;
8888

89-
var model = new TabModel(frame.FrameMoniker.Filename);
89+
var model = new TabModel(FixFileNameCase(frame.FrameMoniker.Filename));
9090
frame.PropertyChanged += (sender, args) =>
9191
{
9292
if (args.PropertyName == nameof(WindowFrame.AnnotatedTitle))
93-
model.FullPath = frame.FrameMoniker.Filename;
93+
model.FullPath = FixFileNameCase(frame.FrameMoniker.Filename);
9494
};
9595

9696
_displayPathResolver.Add(model);
@@ -121,5 +121,21 @@ private static TProperty EnsurePropertyValue<T, TProperty>(T target, DependencyP
121121
}
122122
return value;
123123
}
124+
125+
private static string FixFileNameCase(string fileName)
126+
{
127+
try
128+
{
129+
var pathParts = fileName.Split(Path.DirectorySeparatorChar);
130+
var fixedPath = pathParts[0].ToUpperInvariant() + "\\";
131+
for (var i = 1; i < pathParts.Length; i++)
132+
fixedPath = Directory.GetFileSystemEntries(fixedPath, pathParts[i])[0];
133+
return fixedPath;
134+
}
135+
catch
136+
{
137+
return fileName;
138+
}
139+
}
124140
}
125141
}

0 commit comments

Comments
 (0)