From ttenzin at gmail.com Thu Dec 22 13:01:14 2005 From: ttenzin at gmail.com (Tenzin Togden) Date: Thu, 22 Dec 2005 18:01:14 +0000 Subject: [Biococoa-dev] opening greyed out files Message-ID: Would this modified to suit your needs work ? find . -type f -print0 | xargs -0 -n 1 SetFile -a l Unlocks all the files in the current directory and below. find . -type f -print0 | xargs -0 -n 1 SetFile -a L Locks all the files in the current directory and below. Tenzin -------------- next part -------------- An HTML attachment was scrubbed... URL: From kvddrift at earthlink.net Fri Dec 23 12:24:12 2005 From: kvddrift at earthlink.net (Koen van der Drift) Date: Fri, 23 Dec 2005 12:24:12 -0500 Subject: [Biococoa-dev] opening greyed out files In-Reply-To: References: Message-ID: <25D7C0EF-48FF-4040-B5F1-2648A52D980C@earthlink.net> On Dec 22, 2005, at 1:01 PM, Tenzin Togden wrote: > Would this modified to suit your needs work ? > > find . -type f -print0 | xargs -0 -n 1 SetFile -a l > > Unlocks all the files in the current directory and below. > > > find . -type f -print0 | xargs -0 -n 1 SetFile -a L > > Locks all the files in the current directory and below. Looks like a command line command to me, will that work in an OpenDialog GUI ? After reading some more about this, I think the way to go is with the Authorization API. However, that seems to be more appropropriate for processes, not for files in an OpenDialog. Oh well, I guess I'll have some more reading to do ;-) - Koen. From ttenzin at gmail.com Fri Dec 23 14:12:27 2005 From: ttenzin at gmail.com (Tenzin Togden) Date: Fri, 23 Dec 2005 19:12:27 +0000 Subject: [Biococoa-dev] opening greyed out files In-Reply-To: <25D7C0EF-48FF-4040-B5F1-2648A52D980C@earthlink.net> References: <25D7C0EF-48FF-4040-B5F1-2648A52D980C@earthlink.net> Message-ID: On 12/23/05, Koen van der Drift wrote: > > > On Dec 22, 2005, at 1:01 PM, Tenzin Togden wrote: > > > Would this modified to suit your needs work ? > > > > find . -type f -print0 | xargs -0 -n 1 SetFile -a l > > > > Unlocks all the files in the current directory and below. > > > > > > find . -type f -print0 | xargs -0 -n 1 SetFile -a L > > > > Locks all the files in the current directory and below. > > > Looks like a command line command to me, will that work in an > OpenDialog GUI ? After reading some more about this, I think the way > to go is with the Authorization API. However, that seems to be more > appropropriate for processes, not for files in an OpenDialog. Oh > well, I guess I'll have some more reading to do ;-) > > - Koen. > I was mistakenly expecting the source for SetFile functions to be available as an example. This article http://www.macosxguru.net/article.php?story=20031122090109169 suggests "NSFileManager has the instance method - (BOOL)changeFileAttributes:(NSDictionary *)attributes atPath:(NSString *)path. The key to set file permissions is NSFilePosixPermissions and its value must be a NSNumber with an int value, the 9 right most bits describing the permissions. You can also use the Carbon functions FSGetCatalogInfo and FSSetCatalogInfo, but you probably don't want to link to Carbon only for that purpose, and of course the POSIX functions chmod and fchmod. (man 2 chmod)." and the NSFileManager documentation possibly has the answer here, http://www.toodarkpark.org/computers/objc/Foundation/Classes/NSFileManager.html Tenzin -------------- next part -------------- An HTML attachment was scrubbed... URL: From kvddrift at earthlink.net Fri Dec 23 15:11:32 2005 From: kvddrift at earthlink.net (Koen van der Drift) Date: Fri, 23 Dec 2005 15:11:32 -0500 Subject: [Biococoa-dev] opening greyed out files In-Reply-To: References: <25D7C0EF-48FF-4040-B5F1-2648A52D980C@earthlink.net> Message-ID: <627DA9CB-EEB7-4485-96F1-40A4B05AACD3@earthlink.net> On Dec 23, 2005, at 2:12 PM, Tenzin Togden wrote: > I was mistakenly expecting the source for SetFile functions to be > available as an example. > > This article http://www.macosxguru.net/article.php? > story=20031122090109169 suggests > > "NSFileManager has the instance method - (BOOL)changeFileAttributes: > (NSDictionary *)attributes atPath:(NSString *)path. The key to set > file permissions is NSFilePosixPermissions and its value must be > aNSNumber with an int value, the 9 right most bits describing the > permissions. > You can also use the Carbon functions FSGetCatalogInfo and > FSSetCatalogInfo, but you probably don't want to link to Carbon > only for that purpose, and of course the POSIX functions chmod and > fchmod. (man 2 chmod)." > > and the NSFileManager documentation possibly has the answer here, > > http://www.toodarkpark.org/computers/objc/Foundation/Classes/ > NSFileManager.html > > Tenzin Thanks for the links. Any idea if changeFileAttributes will permanently change the file permissions? In that case it might not be a good approach, because it could change the System files. Anyway, I'll have a go with it and see if I can make the files appear in the open file dialog. BTW, any idea what the approach of TextWrangler/BBEdit could be? These programs have a popup in the OpenDialog, where you can select 'All Files'. Only after selecting that option, the files become selectable. cheers, - Koen. From kvddrift at earthlink.net Fri Dec 23 15:33:16 2005 From: kvddrift at earthlink.net (Koen van der Drift) Date: Fri, 23 Dec 2005 15:33:16 -0500 Subject: [Biococoa-dev] opening greyed out files In-Reply-To: <627DA9CB-EEB7-4485-96F1-40A4B05AACD3@earthlink.net> References: <25D7C0EF-48FF-4040-B5F1-2648A52D980C@earthlink.net> <627DA9CB-EEB7-4485-96F1-40A4B05AACD3@earthlink.net> Message-ID: <7B4D7FFE-3E3C-43C1-B451-C6806353F5A6@earthlink.net> On Dec 23, 2005, at 3:11 PM, Koen van der Drift wrote: > Anyway, I'll have a go with it and see if I can make the files > appear in the open file dialog. Doh, it may be much easier (as usual...). I just came across the NSOpenPanel method setAllowedFileTypes, which seems to solve the problem. This is what I now have in MyDocument: - (IBAction)openDocument:(id)sender { int result; NSOpenPanel *oPanel = [NSOpenPanel openPanel]; [oPanel setAllowsMultipleSelection: NO]; [oPanel setAllowedFileTypes: nil]; result = [oPanel runModalForDirectory: @"path/to/the/exit/" file:nil]; if (result == NSOKButton) { // etc } } And completely unrelated to BioCocoa :) cheers, - Koen.