MBulli / SmartCommandlineArgs

A Visual Studio Extension which aims to provide a better UI to manage your command line arguments
GNU General Public License v2.0
98 stars 35 forks source link

Fix invalid paths in args from throwing uncaught exceptions #149

Closed mitchcapper closed 1 year ago

mitchcapper commented 1 year ago

Closes #148

While we do check for invalid path characters a path is not necessarily only invalid because of a character, but the order in which the chars appear. Enter a url like https://google.com for example:) all are valid in a path but :// is not valid together.

I didn't return null as logically if this function is used for anything else returning the input would probably be expected. I do not believe there is a risk of File.Exists or Directory.Exists throwing an exception as long as the string doesn't contain invalid chars (but order invalid is allowed). The few exceptions I tested it seemed those handled it fine so we didn't need to wrap them too.