Return to Snippet

Revision: 6252
at May 12, 2008 21:54 by zingo


Initial Code
int main (int argc, const char * argv[]) {
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

    struct statfs fsInfo;

    NSLog(@"Testing %s", argv[1]);
    if (statfs(argv[1],  &fsInfo) == -1) {
        NSLog(@"Error %s", argv[1]);
        exit(1);
    }

    if (fsInfo.f_flags & MNT_RDONLY) {
        NSLog(@"Read only %s", argv[1]);
        exit(0);
    }

    NSLog(@"Type %s", fsInfo.f_fstypename);

    [pool release];
    return 0;
}

Initial URL
http://www.cocoabuilder.com/archive/message/cocoa/2006/5/18/163842

Initial Description
This can be used to test FS type.

Initial Title
Filesystem - Testing FS Type

Initial Tags
osx, log

Initial Language
Objective C