4
votes

Say that I have the path C:\My\Multi\Component\Path. Because casing is generally ignored in Windows I could mix and match any casing I please to navigate to this same node in the file system in PowerShell:

1PS> cd C:\My\Multi\Component\Path
2PS> cd C:\my\multi\component\path
3PS> cd C:\My\multi\component\path
4PS> cd C:\my\Multi\Component\PATH

The problem is when I use svn command line tools, for example, svn log .. This only works if I set the location with line (1) above, i.e. using the exact casing matching the underlying path. If I set the location with 2, 3, or 4, svn balks with, for example:

svn: svn: E155010: The node 'C:\My\multi\component\path' was not found.

I understand that the fact that svn is case-sensitive while Windows is not is causing the issue, and I can live with that. But I want a workaround, to wit: a way to find the underlying, cased-as-originally-created path in PowerShell. I can then send my path through this normalization filter before handing it to svn. Unfortunately, PowerShell refuses to yield the true, underlying path to me. I have examined all the properties of Get-Location, Get-Item, and Get-ChildItem.

Is there a way to get the true path?

1
NTFS doesn't really have the concept of case sensitive object names as you noted. What you would need to do is to write your own function that returns the parent folder then recursively walks back up the directory structure building the properly cased path. Here is a .Net example: stackoverflow.com/questions/325931/…EBGreen
For reasons I can't explain (so I won't make it an answer), svn log $pwd works correctly in reproduction of your location #2. Yet $pwd alone returns the improperly-cased path.alroc
@alroc: Indeed that does work--wonderful! Now can you generalize it to an arbitrary path rather than the current path? By that I mean could one type the equivalent of svn log path rather than cd path; svn log . ?Michael Sorens
It looks like you'd have to wrap it in a function. It's not trivial to get the true casing of the path. stackoverflow.com/questions/7195337/…alroc
@EBGreen: Thanks for the reference to a C# solution; that was a good starting point.Michael Sorens

1 Answers

1
votes

I've tested with svn log $pwd and it produces the expected results in all cases.