<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Software Development Bits &#187; C#</title>
	<atom:link href="http://www.brunellweb.com/index.php/category/c-sharp/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.brunellweb.com</link>
	<description>Thoughts, tips, and tricks for .NET development</description>
	<lastBuildDate>Tue, 05 Jan 2010 20:04:53 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How to tell if a path is relative or absolute</title>
		<link>http://www.brunellweb.com/index.php/2007/10/16/how-to-tell-if-a-path-is-relative-or-absolute/</link>
		<comments>http://www.brunellweb.com/index.php/2007/10/16/how-to-tell-if-a-path-is-relative-or-absolute/#comments</comments>
		<pubDate>Tue, 16 Oct 2007 19:21:07 +0000</pubDate>
		<dc:creator>Matt Brunell</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[FileIO]]></category>

		<guid isPermaLink="false">http://www.brunellweb.com/?p=5</guid>
		<description><![CDATA[There is no function or method in the .NET framework to find this out directly.  I had though that Path.IsPathRooted(string) would do the job, but it seems that paths can be both relative, and rooted.  The path "C:bin\Debug\app.exe" is perfectly valid.  So, the only thing to do is to take the input, create the absolute path, [...]]]></description>
			<content:encoded><![CDATA[<p>There is no function or method in the .NET framework to find this out directly.  I had though that <code><a href="http://msdn2.microsoft.com/en-us/library/system.io.path.ispathrooted.aspx" target="_blank">Path.IsPathRooted(string)</a> </code>would do the job, but it seems that paths can be both relative, and rooted.  The path <code>"C:bin\Debug\app.exe" </code>is perfectly valid.  So, the only thing to do is to take the input, create the absolute path, and compare them.  Like this:</p>
<pre class="csharp">private void CheckDestination(string destination)
{
   // Ensure that path is absolute.  Ignore case
   // because filesystem is case-insensitive
   if (string.Compare(destination.Trim(),
      Path.GetFullPath(destination), true) != 0)
   {
        // path is absolute
   }
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.brunellweb.com/index.php/2007/10/16/how-to-tell-if-a-path-is-relative-or-absolute/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
