469,621 Members | 2,271 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,621 developers. It's quick & easy.

Path.GetFullPath and ":"

I want to make sure that a filename is an "absolute path" (ie. has a drive
spec. and root, or else is a UNC path) if it isn't already one.
Path.GetFullPath seems to do the trick, except there is one thing in the MSDN
documentation that makes me nervous.

MSDN says that GetFullPath will throw NotSupportedException if its argument
contains a ":". If GetFullPath behaved this way I would not be able to use it
because, for example, Path.GetFullPath(@"D:\file.ext") would throw an
excpetion. Instead, I find that it does not throw an exception, but returns
"D:\file.ext" as I would like.

Does anyone know which behavior is correct? Is Path.GetFullPath supposed to
throw an exception if its argument contains a ":"? Or, is it that a ":" in
the pathname now supported in .NET 1.1 and the documentation is out of date?

Thanks in advance for any help,
Mark Urish

Jul 21 '05 #1
3 3788
I wasn't able to find the part of MSDN that states that GetFullPath will
throw a NotSupportedException if the argument contains a ":"
After creating a quick test program, I confirmed that GetFullPath returns
the full path just as expected even when the input is already a full path.

--
Ben Lucas
Lead Developer
Solien Technology, Inc.
www.solien.com
"Mark Urish" <Ma*******@discussions.microsoft.com> wrote in message
news:C8**********************************@microsof t.com...
I want to make sure that a filename is an "absolute path" (ie. has a drive
spec. and root, or else is a UNC path) if it isn't already one.
Path.GetFullPath seems to do the trick, except there is one thing in the
MSDN
documentation that makes me nervous.

MSDN says that GetFullPath will throw NotSupportedException if its
argument
contains a ":". If GetFullPath behaved this way I would not be able to use
it
because, for example, Path.GetFullPath(@"D:\file.ext") would throw an
excpetion. Instead, I find that it does not throw an exception, but
returns
"D:\file.ext" as I would like.

Does anyone know which behavior is correct? Is Path.GetFullPath supposed
to
throw an exception if its argument contains a ":"? Or, is it that a ":" in
the pathname now supported in .NET 1.1 and the documentation is out of
date?

Thanks in advance for any help,
Mark Urish

Jul 21 '05 #2
Thanks for your response.

The msdn doc I am referring to is:

http://msdn.microsoft.com/library/de...lpathtopic.asp

In the the Exceptions section:
Exception Type Condition
NotSupportedException: path contains a colon (":").
"Ben Lucas" wrote:
I wasn't able to find the part of MSDN that states that GetFullPath will
throw a NotSupportedException if the argument contains a ":"
After creating a quick test program, I confirmed that GetFullPath returns
the full path just as expected even when the input is already a full path.

--
Ben Lucas
Lead Developer
Solien Technology, Inc.
www.solien.com
"Mark Urish" <Ma*******@discussions.microsoft.com> wrote in message
news:C8**********************************@microsof t.com...
I want to make sure that a filename is an "absolute path" (ie. has a drive
spec. and root, or else is a UNC path) if it isn't already one.
Path.GetFullPath seems to do the trick, except there is one thing in the
MSDN
documentation that makes me nervous.

MSDN says that GetFullPath will throw NotSupportedException if its
argument
contains a ":". If GetFullPath behaved this way I would not be able to use
it
because, for example, Path.GetFullPath(@"D:\file.ext") would throw an
excpetion. Instead, I find that it does not throw an exception, but
returns
"D:\file.ext" as I would like.

Does anyone know which behavior is correct? Is Path.GetFullPath supposed
to
throw an exception if its argument contains a ":"? Or, is it that a ":" in
the pathname now supported in .NET 1.1 and the documentation is out of
date?

Thanks in advance for any help,
Mark Urish


Jul 21 '05 #3
Interesting. Well, given the test I ran yesterday, I would assume that it
means if the path contains a ":" after the first "\", which would be a bad
path, but again, in testing yesterday, using a full path returned a full
path without throwing any exceptions.

--
Ben Lucas
Lead Developer
Solien Technology, Inc.
www.solien.com

"Mark Urish" <Ma*******@discussions.microsoft.com> wrote in message
news:69**********************************@microsof t.com...
Thanks for your response.

The msdn doc I am referring to is:

http://msdn.microsoft.com/library/de...lpathtopic.asp

In the the Exceptions section:
Exception Type Condition
NotSupportedException: path contains a colon (":").
"Ben Lucas" wrote:
I wasn't able to find the part of MSDN that states that GetFullPath will
throw a NotSupportedException if the argument contains a ":"
After creating a quick test program, I confirmed that GetFullPath returns
the full path just as expected even when the input is already a full
path.

--
Ben Lucas
Lead Developer
Solien Technology, Inc.
www.solien.com
"Mark Urish" <Ma*******@discussions.microsoft.com> wrote in message
news:C8**********************************@microsof t.com...
>I want to make sure that a filename is an "absolute path" (ie. has a
>drive
> spec. and root, or else is a UNC path) if it isn't already one.
> Path.GetFullPath seems to do the trick, except there is one thing in
> the
> MSDN
> documentation that makes me nervous.
>
> MSDN says that GetFullPath will throw NotSupportedException if its
> argument
> contains a ":". If GetFullPath behaved this way I would not be able to
> use
> it
> because, for example, Path.GetFullPath(@"D:\file.ext") would throw an
> excpetion. Instead, I find that it does not throw an exception, but
> returns
> "D:\file.ext" as I would like.
>
> Does anyone know which behavior is correct? Is Path.GetFullPath
> supposed
> to
> throw an exception if its argument contains a ":"? Or, is it that a ":"
> in
> the pathname now supported in .NET 1.1 and the documentation is out of
> date?
>
> Thanks in advance for any help,
> Mark Urish
>


Jul 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Michiel Schaeverbeke | last post: by
9 posts views Thread by Clinton Frankland | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.