osx - Detection of framework usage on Mac system? -
i wanted develop sample framework on osx having requirement @ point in time framework should used single client, not getting how achieve ? api's detect weather framework in use? can use file related api this?..i have seen windows sample where detecting dylib's usage using following api's ?? createfilemappingw mapviewoffile openfilemappingw
does has come across such scenarios??
you can use lsof command. return list of open files.
in absence of options, lsof lists open files belonging active processes.
nstask* task = [[nstask alloc] init]; nspipe* pipe = [[nspipe alloc] init]; nsarray* args = [nsarray arraywithobjects: @"-c", @"lsof | grep -i some.framework | wc -l",nil]; [task setlaunchpath: @"/bin/sh"]; [task setarguments: args]; [task setstandardoutput: pipe]; [task setstandarderror: pipe]; [task setstandardinput: [nspipe pipe]]; [task launch]; [task waituntilexit]; nsfilehandle* file = [pipe filehandleforreading]; nsstring* result = [[nsstring alloc] initwithdata: [file readdatatoendoffile] encoding: nsasciistringencoding]; nslog(@"%@",result); [result release]; [task release]; [pipe release];
Comments
Post a Comment