Clean up executable path grabbing, and fix sscanf bug where filenames contain spaces.