Skip to content

Commit

Permalink
Show paths with correct casing.
Browse files Browse the repository at this point in the history
  • Loading branch information
DarkDaskin committed Jun 28, 2019
1 parent e44c57f commit 5faf986
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions VSTabPath/TabTitleManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -121,5 +121,21 @@ private static TProperty EnsurePropertyValue<T, TProperty>(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;
}
}
}
}

0 comments on commit 5faf986

Please sign in to comment.