Blog for January 2012

Daily Links

Daily Links

Daily Links

Daily Links

Daily Links

Daily Links

Daily Links

Daily Links

Daily Links

Daily Links

Including All Cake Templates in Coda Search

I'm currently using Coda 1.7.4, but I've had a persistant problem across several versions of Coda where the ".ctp" templates in my CakePHP projects would be ignored in the Coda search results. I had things working most of the time by setting up a Custom Syntax Mode in Coda to display ".ctp" files with PHP highlighting. That got things working for most of the search types Coda supports, but when using "find in folder" some of the templates were still ignored.

Eventually I was able to figure out out a way to consistently trigger the issue after noticing that the icon Coda used for the file it was ignoring was not the same as the ones for the files it included. The ignored file had the same icon as an executable bash script, and sure enough when I checked the file permissions the file was marked as executable. After a few tests, I was able to determine that the rule was as follows:

  •  If any of the executable flags are set,
  •  and the file extension is not known,
  •  and the search type is "find in folder",
  •  Then the file will not be searched.

That made sense, since it wouldn't do to search through binary files. There's no reason for the template files to be executable, anyway, so the right thing to do  was to change the permissions on the file. But that wouldn't help me make mass changes across multiple files if I didn't know that the file permissions were messed up.

Files ending in ".php", however, are searched even when they are executable, so not all executable files are ignored. How could I set things up so ".ctp" files would work the same way? I tried using a completely made up extension, and it behaved the same way as ".ctp". Setting Coda as the default application to open ".ctp" files and setting a Custom Syntax Mode for ".ctp" files in Coda had no effect. I was a bit lost as to what constituted an "unknown" file extension. Especially since some of my coworkers did not have this problem.

I emailed Panic, the makers of Coda, and they were able to confirm that this was a problem some people had. It was not, however, due to anything in Coda itself. Instead the problem was due to the Spotify service in OS X not indexing certain files. Knowing that, I noticed that Finder reported the file "kind" as "Executable Unix File". So I did some research into how to change that. A quick Google search led me to an article about changing a file's "kind". So I tried the following:

  • Right clicked on the Coda app in Finder and selected "Show Package Contents"
  • Inside the package is a "Contents" folder, and inside that is a file named "Info.plist", which I opened in a text editor.
  • I found the section in that file where PHP file extensions are associated with Coda, and added two new entries to the <array> element <string>ctp</string> and <string>CTP</string>.

After saving those changes, exectuable ".ctp" files could be searched in the same manner as executable ".php" files. Hopefully this will be helpful to other people who are having the same problem.

Daily Links