PHP's realpath equivalent to C# -
is there function in c# equivalent php's realpath unix paths?
i couldn't find , writing 1 scratch seems quite time consuming.
i know of getfullpath
has following problems (for me):
- it's windows path that's being returned, given
"//foo//../bar///c"
,"t:\bar\c"
returned. - it removes spaces directory names, given
"/foo bar/baz"
,"t:\foobar\baz"
returned. - giving
console.writeline(path.getfullpath( "//d/"));
doesn't compile ,argumentexcpetion
message:the unc path should of form \\server\share.
i think depends in want , type of application you're writing in c#
in system.io
there several path specific function
i.e. system.io.path.getdirectoryname
you can executing assembly path using reflection i.e. system.reflection.assembly.getexecutingassembly().location
in mvc there mappath in httpcontext i.e. httpcontext.current.server.mappath
there several options, , extensible.
what particular problem?
Comments
Post a Comment