Pref Migration Summary

Richard Laager rlaager at wiktel.com
Wed Apr 11 23:29:14 EDT 2007


Taking everything into account, I'm proposing a solution (in a
pseudo-code mix of C and sh) and look forward to feedback:

On load:

if ~/.purple does not exist or ~/.ppurple/migrating exists
{
	if (~/.gaim exists)
	{
		touch ~/.purple/migrating

		# If this fails, we bail with an error and refuse to
		# start Pidgin.  The migrating file acts as a guard
		# to ensure we only move forward if we completed a
		# full migration.
		cp ~/.gaim/<FILES> ~/.purple

		if ~/.gaim/logs is a directory &&
		   rename(~/.gaim/logs, ~/.purple/logs)
		{
			symlink ~/.gaim/logs to ../.purple/logs
		}
		else
		{
			display error to user for manual intervention,
			but allow Pidgin to load
		}
	}

	rm ~/.pidgin/migrating 
}

On prefs load:
	Modify Gaim prefs into purple/pidgin prefs as they're loaded.

In this way, preferences will be migrated in memory and will be written
to disk opportunistically. This technique also keeps things working if
someone renames .gaim to .purple before running Pidgin/Finch.

By moving the logs, we protect against the case where a user deletes
~/.gaim thinking it's no longer used and then loses all their logs.
However, we've protected against screwing with a symlink. By symlinking
~/.gaim/logs to .purple/logs, we ensure back and forth log
compatibility.

In the case of Windows, where we can't symlink the logs, I'd say we'll
just hope the user never goes back to Gaim. If they do, they'll just
have to deal manually.

How does this sound?

Richard
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://pidgin.im/pipermail/devel/attachments/20070411/e3b5b13a/attachment.sig>


More information about the Devel mailing list