[futurebasic] Re: [FB] FILES$(_FSSpecOpen... problem with TeachText files

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : October 2004 : Group Archive : Group : All Groups

From: Robert Purves <robert.purves@...>
Date: Mon, 25 Oct 2004 19:45:55 +1300
Rich Love wrote:

> I can't seem to get FB4 to open a text file created with TeachText 
> when I specify TEXT as the file type.
> Why does the following routine not work?
> It shows the TeachText file dimmed out so I cannot select it.
> I have saved the TeachText file as a text file (not rtf and put a .txt 
> extension on it.
> When I use ResEdit to look at the file, it says the file type is TEXT 
> and the creator is ttxt.
> If I change the creator to ???? then FB will open the file.
> Why does FB not like ttxt?
>
> dim filename as str63
> dim fileSpecRecord as FSSpec
> filename = FILES$(_FSSpecOpen,"TEXT","Pick a file to open", 
> fileSpecRecord)


1.  Presumably you meant to write TextEdit, that being the OS X default 
application for, um, text-editing. Unless there's a problem with 
TeachText files too...

2.  I confirm your report (in 10.3.6). TextEdit's plain text files are 
not selectable in the file dialog.

3.  If you open the offending file in ResEdit, thus creating an (empty) 
resource fork alongside the data fork that TextEdit created, save the 
file, then run the open dialog test again, the file can now be chosen.  
Adding a resource fork to the file fixes the problem, for reasons 
unclear.

4.  Even more weirdly, if you Get File/Folder Info for the offending 
file in ResEdit, edit the type and creator, but leave them as TEXT and 
ttxt (exactly as they were originally), save the file, then run the 
open dialog test again, the file can now be chosen.

5.  I read somewhere a vague complaint that Cocoa apps are 'bad' about 
setting type/creator information for their files.

6.  Speculation:  It seems as though TextEdit only partly sets the 
type/creator.  They are stored in the file's meta-information, where we 
can see them with ResEdit. But they are not enabled properly, and so a 
Navigation Services file dialog fails to recognise them. Twiddling the 
file with ResEdit has the mysterious effect of enabling the creator and 
type.

Robert P.