[Mono-list] directory path separator
Michael J. Ryan
tracker1_lists@theroughnecks.com
Fri, 17 Sep 2004 03:22:03 -0700
Kevin White wrote:
> In java there is the notion of using a system variable to tell you
> what the platform-specific folder separator is. Is the same true for
> .Net? I've only done .Net on windows and haven't cared until now.
>
> I'd like my code to be portable between windows and linux using .Net
> and mono. I take one of the "special" folders from
> Environment.GetFolder(), and append some directory structure to that
> to do some work. How do I know what folder separator to use?
Not 100% sure if they work right on mono, but FileInfo, and DirectoryInfo
objects are your friends, if you are targetting windows, and *nix, the
forward-slash is an alternate separator in windows, and should work fine
by switching.. there are the following static values you can reference.
System.IO.Path.AltDirectorySeparatorChar
System.IO.Path.DirectorySeparatorChar
System.IO.Path.PathSeparator
System.IO.Path.VolumeSeparatorChar
probably already answered though.. :)
--
Michael J. Ryan - tracker1(at)theroughnecks(dot)com - www.theroughnecks.net
icq: 4935386 - AIM/AOL: azTracker1 - Y!: azTracker1 - MSN/Win: (email)