| MsgBox(New
| Uri("ftp://pop.com/pop.bmp").Scheme.Equals(Uri.UriSchemeFile)) << false
Yes one could, however if you are checking IsFile in a number of places,
that is a lot of duplicated code.
Further IsFile feels like an attribute of Uri, while UriSchemeFile feels
more like an implementation detail.
To understand the smell of duplicated code see Refactoring by Martin Fowler:
http://martinfowler.com/books.html#refactoring
http://www.refactoring.com/
--
Hope this helps
Jay B. Harlow [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley -
http://www.tsbradley.net
| Hi Jay,
|
| > A file URI uses the "file" scheme, your uri is using the "ftp" scheme.
|
| Hmm, that just seems like a waste of a function to be honest. If all
it
| is doing is checking for a "file://" protocol then that feature is already
| available via.
|
| MsgBox(New
| Uri("ftp://pop.com/pop.bmp").Scheme.Equals(Uri.UriSchemeFile)) << false
| MsgBox(New
| Uri("file://pop.com/pop.bmp").Scheme.Equals(Uri.UriSchemeFile)) << true
|
| > | Are there any other ways of detecting if this is a file reliably?
| > What do you mean by "a file"?
|
| i.e. not just a path like
|
|
http://www.mysite.com/pop/
|
http://www.mysite.com/pop/pants/
|
http://www.mysite.com/pop/pants/foobar/
|
| more like
|
|
http://www.mysite.com/pop/pants/myfile.html
|
http://www.mysite.com/pop/pants/football/myfile2.html
|
| I've resorted to checking for a trailing backslash on the absolute
path.
| If it's not then it's presumed to be a file. Although this is not ideal
it
| is working for what I currently want it for.
|
| Cheers for clearing that up for me anyway.
|
| Nick.
|
|