On Sun, 2009-04-19 at 12:51 -0700, Heertsch wrote:
> is there a way to get the value auf PATH_MAX (linux constant for lenght of a
> pathname in bytes) into c# code?

I would suggest not using any such mechanism, if possible, as not all
platforms have an actual filename limit (e.g. GNU HURD).  Even for
platforms with such a limit, the limit may be limited by the filesystem
itself or application compatibility (e.g. ISO has a 180 character path
limit [0] while ext3 has a 4096 character path limit, while Windows has
a 260 character upper limit regardless of filesystem due to application
compatibility restraints).

Consequently, it's usually preferable to not hardcode such a limit.

In the event that you must have a limit, under Linux you can use
Syscall.pathconf() [0] with PathconfName._PC_PATH_MAX:

        long maxPathLen = 
            Syscall.pathconf("/", PathconfName._PC_PATH_MAX);

 - Jon

[0] 
http://www.go-mono.com/docs/index.aspx?link=M%3aMono.Unix.Native.Syscall.pathconf(System.String%2cMono.Unix.Native.PathconfName)


_______________________________________________
Mono-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-list

Reply via email to