Reading OSS Code to Figure Out What Is Actually Going On
Take a look at how this developer attempts to discover the root of an issue in his open source tooling by digging through the source code.
Join the DZone community and get the full member experience.
Join For FreeI use Open Live Writer to post to this blog, but the problem is that whenever I post a new post, it opens up the metadata api endpoint in the browser (services/metaweblogapi.ashx). I actually want to see the blog post that I just posted. I decided that this was annoying enough that I’m going to figure out how this is done and see if there is a way for my blog to give Open Live Writer the address of the newly created post.
I want this to be a focused operation, I don’t wanna read through it all. So I’m going to see if I can figure out how this works with minimum effort. I know that OLW is opening the browser after the post is published, this is usually done with Process.Start, so I run the following query:
The very first result is promising, showing ExecuteFile. This sounds interesting, let’s see how this is used. No one seems to be calling this method, but reading through the ShellHelper file, I run into LaunchUrl(), which seems promising. Searching for this method got me to some interesting locations, including the ViewPage method, which seems to be exactly what I want.
This seems to indicate that the blog post should support pages, not sure what this is about, but I found this piece of code by searching for IsPage:
Not sure what pages are, but looking at the configuration for my blog, I see:
Continuing my blaze through the code, I can see we have:
My blog doesn’t implement this method, but OLW doesn’t probe for this. It seems that because I’m using the generic interface, it already pre-loaded the available options there. What this means is that this exploration ended up at a dead end. I figured out roughly what is going on, but actually getting all the details is probably too much of a hassle for me to debug through the OLW code and update my blog engine. I’m already used to just closing the newly opened tab and go to the new post directly. I’ll keep this in my to-do tasks for when I actually get around to doing this.
Published at DZone with permission of Oren Eini, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments