A customer wondered how to get at the state information Komodo saves between sessions. There are three files in saved in the profile directory:
prefs.xml
doc-state.xmlc
view-state.xmlc
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["@activestate.com/koDirs;1"].getService(Components.interfaces.koIDirs);
var userDataDir = dirSvc.userDataDir;
var osPathSvc = Components.classes["@activestate.com/koOsPath;1"].
getService(Components.interfaces.koIOsPath);
var factory = Components.classes["@activestate.com/koPreferenceSetObjectFactory;1"].
getService();
//
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);
factory.deserializeFile(fullPath).serializeToFile(targetPath);
}
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.
Title photo courtesy of Photo Mix on Pixabay.
ActiveState Unveils Open Source Management Platform to Automate Software Supply Chain Security, Boosting Developer Agility and Centralizing Governance and Visibility of Open Source In Use Across the Organization
Reimagined platform unifies software supply chain security and simplifies governance, dependency, vulnerability, and license management into a single DevSecOps platform ActiveState is redefining open source management with the launch of