How to Unpickle Komodo's "xmlc" files
by Eric Promislow

Eric Promislow, March 27, 2009

A customer wondered how to get at the state information Komodo saves between sessions. There are three files in saved in the profile directory:




The "xmlc" files are pickled XML files, and are essentially unreadable outside Komodo. They're hard to unpickle outside Komodo, as they contain instances of objects Komodo knows about. But it's easy to write a macro to do the unpickling:

var dirSvc = Components.classes[";1"].getService(Components.interfaces.koIDirs);
var userDataDir = dirSvc.userDataDir;
var osPathSvc = Components.classes[";1"].
var factory = Components.classes[";1"].
var targetDir = "/tmp/";
// Would be better to get the list of *.xmlc files where
// there's no .xml file in place.
var pickledFiles = ['doc-state.xml', 'view-state.xml'];
for (var file, i = 0; file = pickledFiles[i]; i++) {
var fullPath = osPathSvc.join(userDataDir, file);
var targetPath = osPathSvc.join(targetDir, file);

I've deliberately had the macro write the plain-text XML files
into a scratch directory, so I can modify the files.

For extra fun, Komodo is flexible when it loads prefs -- if it
can't find a .xmlc file, it will look for a .xml file with
the same root, and load prefs from that instead.

Subscribe to ActiveState Blogs by Email

Share this post:

About the Author: RSS

Eric Promislow is a senior developer who's worked on Komodo since the very beginning. He has a M.Sc. in Computing Science from Queen's University and a B.Sc. in Biophysics from the University of Ontario. Before joining ActiveState, he helped create the OmniMark text-processing language.