[Mono-list] Directory Symbolic link?
Gonia Eric - egonia
egonia@mail15.com
Mon, 09 Feb 2004 13:42:42 -0600
--=-4G7xcrUJ8iYnclQX+H++
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Is there a way to determine if a directory is a symbolic link or a real
directory with mono?
The attached code enters a recursive loop due to recursive symbolic
links on my computer.
Thanks for any help anyone can provide,
Eric
--=-4G7xcrUJ8iYnclQX+H++
Content-Disposition: attachment; filename=FolderSize.cs
Content-Type: application/cs; name=FolderSize.cs
Content-Transfer-Encoding: base64
dXNpbmcgU3lzdGVtOw0KdXNpbmcgU3lzdGVtLklPOw0KDQpwdWJsaWMgY2xhc3MgRm9sZGVyU2l6
ZQ0Kew0KCXByb3RlY3RlZCBzdHJpbmcgX3Jvb3RGb2xkZXI7DQoJDQoJcHVibGljIHN0YXRpYyB2
b2lkIE1haW4oc3RyaW5nW10gYXJncykNCgl7DQoJCWlmIChhcmdzLkxlbmd0aCAhPSAxKQ0KCQl7
DQoJCQlDb25zb2xlLldyaXRlTGluZSgiXG5cdFVzYWdlOiBGb2xkZXJTaXplIGZvbGRlcl9uYW1l
XG4iKTsNCgkJfQ0KCQllbHNlDQoJCXsNCgkJCWlmICghIERpcmVjdG9yeS5FeGlzdHMoYXJnc1sw
XSkpDQoJCQl7DQoJCQkJQ29uc29sZS5Xcml0ZUxpbmUoInswfSBkb2VzIG5vdCBleGlzdC5cbiIs
IGFyZ3NbMF0pOw0KCQkJCXJldHVybjsNCgkJCX0NCgkJCQ0KCQkJdWxvbmcgZm9sZGVyU2l6ZSA9
IEdldEZvbGRlclNpemUoYXJnc1swXSk7DQoJCQkNCgkJCUNvbnNvbGUuV3JpdGVMaW5lKCJ7MH0g
c2l6ZSBpcyB7MX0gYnl0ZXMuIiwgYXJnc1swXSwgZm9sZGVyU2l6ZSk7DQoJCQlDb25zb2xlLldy
aXRlTGluZSgiezB9IHNpemUgaXMgezF9IGtpbG9ieXRlcy4iLCBhcmdzWzBdLCBmb2xkZXJTa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