[Mono-list] Handling file paths for different operating systems

Jim Erwin mono@eyekahn.com
Sat, 07 Feb 2004 08:51:20 -0600


If cross-platform pathing issues are a concern for you, you could handle
it the way you described (different setting for each OS you might deploy
on). Ff the path setting is going to be relative to a single main
application path (such as where your EXE is) that you can
programatically determine, and/or you can determine your OS
programatically, you could write a path factory class that will
"translate" your configuration file entry to the way that it should be
for the current host OS. Bascially, your path factory would be
instantiated by your application class. The application class would pass
the key value from your configuration settings file along with which OS
it needs the correct version for. Then your path factory would return
the correct syntax for your specific OS.

In fact, if you write such a path factory class, it would be nice to
share it with the rest of us <g>.



On Sat, 2004-02-07 at 01:20, Timothy Parez wrote:
> Hi,
> I'm wondering, if you have an application which uses a file path for one 
> of its setttings,
> for example in the .config file of the application there's an entry: 
> <add key="PluginDirectory" value="")
> Of course I could have an entry for each different OS, but that's not 
> exactly nice design,
> how can I write down a path in a universal way, or make it so that it 
> works on all systems
> Thnx.
> _______________________________________________
> Mono-list maillist  -  Mono-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
Jim Erwin <mono@eyekahn.com>