'ST2/ST3-compatible wrapper for getting the project file for a window, made possible with
titoBouzout\'s getProjectFile method in SideBarEnhancements (refactored to project_file_name)'

def project_file_name(self):

    window = sublime.active_window()
    if (not window):
        return
    if hasattr(window, u'project_file_name'):
        return window.project_file_name()
    wid = window.id()
    now = time.time()
    try:
        (project_file_name, before) = self.project_file_names[wid]
        if (now > (before + 10)):
            raise KeyError
    except KeyError:
        pass
    folders = window.folders()
    if (not folders):
        return
    settings_path = os.path.normpath(os.path.join(sublime.packages_path(), u'..', u'Settings'))
    folders = set((os.path.realpath(f) for f in folders))
    session_filename = os.path.join(settings_path, u'Session.sublime_session')
    project_file_name = self._check_project_file_name(folders, session_filename)
    self.project_file_names[wid] = (project_file_name, now)
    return project_file_name
