CTconfig

CTconfig is a universal binary utility program designed to execute in the Terminal application in the MacOS Unix environment (Terminal.app). It is designed to set the "signature" of filenames supplied to it. It does that by comparing the ".suffix" in each filename to a list of suffixes supplied by the TEXT file called "CTconfig.plist", which must exist as a standard XML text file in your ~/Library/Preferences directory-folder. The CTconfig application comes with a CTconfig.plist file which you should copy/move to your ~/Library/Preferences directory, either with Finder or with Unix "cp" or "mv" commands issued from within the Terminal application.

The CTconfig.plist file is a standard TEXT file that can be edited by most editor applications like BBEdit, TextEdit, or Unix editors like "vi" or "emacs". I recommend BBedit ot TextEdit.

CTconfig.plist contains a series of <dict>...</dict> entries inside the <array>...</array> associated with the <key>ic-added-mappings</key> heading. This organization is important because CTconfig reads this CTconfig.plist file from the ~/Library/Preferences directory and looks for these markers. The <dict>...</dict> entries are a series of <key>label</key><string>value</string> terms. Each term defines a "label" and associated "value". CTconfig is looking for labels "type", "creator", and "suffix", and saves the associated values in a quick-lookup table. CTconfig does NOT create a table entry unless it finds all three labels in a <dict>...</dict>. You can have additional key/string pairs, and in fact, the CTconfig.plist comes with "appl" and "desc" terms that indicate the Application and Description associated with the signature. Each type/creator pair associated with a suffix is considered a signature.

The values associated with type and creator must BOTH be 4-character strings. That is:

All keys must be lower case. But strings may be all lower, all UPPER, or MiXed case. The suffix may be variable length, and usually has a value that begins with a dot.

If there is no leading dot, then the suffix represents a filename which has no dots. This can be handy for providing a signature to non-suffixed files.

Since type and creator string values must be EXACTLY four-characters long, a special case is made for an all-blank (four blank characters) type and/or creator. If the filename supplied has the matching suffix, the blank type or creator terms cause that portion of the signature to be set to null (''). For example:

This would set the signature of all fname.txt files to type='TEXT', creator=''

CTconfig allows multiple signatures based upon differences in case for each suffix. The default is an all lower case suffix, like .txt or .pict, etc. But .txt and .TXT are considered seperate signatures by CTconfig. The suffix of your input filename is checked "as is", without changing case. If a match is found in the lookup table, that is the signature to be applied. But is no match is found, the supplied suffix is forced to lower case and the table is searched again. This may result in a match, which would be the signature to apply. If you don't supply an all lower case <suffix> value for the table, only the "as is" match is possible.

If no match is made for the supplied suffix, CTconfig then checks two options:

If no match is made, and you didn't give CTconfig either or both of the options listed above, CTconfig does nothing to your file.

If CTconfig does change your file, the -v option tells CTconfig to display the SetFile command that is used to make the changes.

CTconfig has a special -f option that circumvents the search of the lookup table, and does the same action as the -n option (above). The result is that every file processed by CTconfig when -f is specified forces both type and creator to null ('').

CTconfig has two other options that, if supplied, are acted upon, and then CTconfig immediately exits.

Do NOT supply -p or -h or -ph options if you want your filename processed.

If you do not supply a filename, and expect normal filename processing, then CTconfig will read filenames from standard input until end-of-file. This makes it possible to supply a prebuild list of filenames to CTconfig. Here are two examples:

Note that in the example above, I specified "ctconfig", NOT "CTconfig". That's because I defined an alias and placed it in my .login or .bash_login file.

I placed my CTconfig application in my $HOME directory. I'm now able to access it from anyplace. This means you can navigate to wherever the files are located, and process them without having to worry about fully-qualified path names for files.

CTconfig can take fully-qualified filenames, relative-path filenames, and home-path filenames. Here are some examples:

Notice I used a direct reference to CTconfig in the first example, and alias references (ctconfig) in the others.

The first example shows a relative-path filename. You are in some directory that contains a "subdir" directory (folder) in which the target file is located. Also, the -c option says to set the signature based upon a .txt suffix, but if there is no such signature in the CTconfig.plist, reset the "Custom icon" bit for this file (as a minimum action). Of course, if you were in the directory that contained the target file, you would just specify the target filename.

The second example follows a fully-qualified path, tells you what SetFile command is issued (because of -v), and does type/creator resets if there is no ".pdf" suffix in the CTconfig.plist file (because of -n).

The third example supplies a filename that begins with "~/", which CTconfig interpretes as meaning to replace the "~" with your $HOME directory, and then process. The resulting filename would be something like:

This would do nothing unless there was an ".html" suffix in the table.

When supplying a list of filenames to CTconfig, make sure each filename is a separate line. If you pipe the output from an "ls" command into CTconfig, be sure to use the "dash-one" (-1) option, NOT the "dash-ell" (-l) option.

Final notes: CTconfig makes use of the /Developer/Tools/SetFile utility that comes with Xcode (The Developers toolbox). If you do not have this utility, you can obtain it from Apple. Just be sure that it is installed in the proper directory. If necessary, construct a /Developer/Tools directory path. If you download the CTconfig.folder.tgz file, and expand it into a folder, you'll find a CTinstall program that will install everything you need, including a version of SetFile if you don't already have one. There are both PowerPC and Intel folders that contain those types of CTconfig. The CTinstaller will install the specific type. There's also a "Universal" version outside those folders.

Download CTconfig.folder.tgz