How to extend engine classes in a plugin?

I’ve written a plugin that extends the GameViewportClient class. I added the following line to my project’s Config/DefaultEngine.ini file to make it work:

[/Script/Engine.Engine]
GameViewportClientClassName=MyPlugin.CustomViewportClass

This works fine on that particular project. However, now I want to distribute the plugin, and people who download my plugin shouldn’t have to muck about with overriding engine classes. Is there any way to tell the engine to use my class instead of the default class, from within the plugin itself?

My goal is to have the plugin work as soon as a user downloads it to their Plugins folder. As it is now, the plugin is not running because the default Viewport class is used instead of mine.

Found a solution!

You can access config files by including the ConfigCacheIni.h header. I included it in my core Plugin.cpp file, and used GConfig->SetString() to write that one line to the config files.

Rama has a very helpful tutorial about this over at the wiki.