cross platform application configuration files

David Eppstein eppstein at ics.uci.edu
Fri Feb 28 14:14:27 EST 2003


In article <v5vcfsi2aigq6f at corp.supernews.com>,
 Lee Harr <missive at frontiernet.net> wrote:

> I also got (in the email) a suggestion to use XML.
> 
> My question, though, is more about where to put the file,
> and how to find it again on any platform.

If you're going to go with XML, it would make sense to use a dtd that's 
already been defined for that purpose, such as Apple's plist, rather 
than making up your own.

On OS X, application configuration files are storedin the directory 
~/Library/Preferences/.  The file name is usually either the application 
name or a reversed domain name, and the format is usually XML with 
extension ".plist".

E.g. in my files, ~/Library/Preferences/com.apple.MenuBarClock.plist
looks like:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>AppendAMPM</key>
        <true/>
        <key>ClockDigital</key>
        <true/>
        <key>ClockEnabled</key>
        <true/>
        <key>DisplaySeconds</key>
        <false/>
        <key>FlashSeparators</key>
        <false/>
        <key>PreferencesVersion</key>
        <integer>1</integer>
        <key>ShowDay</key>
        <true/>
</dict>
</plist>

-- 
David Eppstein                      http://www.ics.uci.edu/~eppstein/
Univ. of California, Irvine, School of Information & Computer Science




More information about the Python-list mailing list