What is the best way to combine a path with a file name?
That is, given c:\foo and bar.txt , I want c:\foo\bar.txt .
Given c:\foo and ..\bar.txt , I want either an error or c:\foo\bar.txt (so I cannot use Path.Combine() directly). Similarly for c:\foo and bar/baz.txt , I want an error or c:\foo\baz.txt (not c:\foo\bar\baz.txt ).
I understand, I could check that the file name does not contain '\' or '/', but is that enough? If not, what is the correct check?
Rasmus Faber Jun 26 '09 at 9:09 2009-06-26 09:09
source share