import sublime
import sublime_plugin


class JenkinsfileSyntax(sublime_plugin.EventListener):
    def on_load(self, view):
        filename = view.file_name().split('/')

        if filename[-1].lower() == 'jenkinsfile':
            view.set_syntax_file('Packages/jenkinsfile-syntax/Groovy.tmLanguage')


import sublime
import sublime_plugin


class JenkinsfileSyntax(sublime_plugin.EventListener):
    def on_load(self, view):
        filename = view.file_name().split('/')

        if len(filename) and filename[-1].lower() == 'jenkinsfile':
            view.set_syntax_file('Packages/jenkinsfile-syntax/Groovy.tmLanguage')


check length to be sure it is possible to get the last index