Example #1
0
    def get_launch_script(self, type):
        path = addon_path + '/resources/scripts/'+type+'/'
        browser_name = None
        double_quotes=''
        bash = ''
        if generic_utility.windows():
            path += 'windows/'
            ending = '.cmd'
            double_quotes = '"'
        elif generic_utility.darwin():
            path += 'darwin/'
            ending = '.sh'
            bash = 'sh '
        else:
            path += 'linux/'
            ending = '.sh'
            bash = 'sh '
        browser_name = self.get_browser_scriptname(browser_name)

        script = path+browser_name+ending

        if generic_utility.windows():
            script = script.replace('/','\\')

        if not os.path.isfile(script):
            generic_utility.error('Script: '+script+' not found!')
            script = ''

        if generic_utility.darwin():
            script = bash + generic_utility.sh_escape(script)
        else:
            script = bash + double_quotes+script+double_quotes

        return script
Example #2
0
    def get_launch_script(self, type):
        path = addon_path + '/resources/scripts/' + type + '/'
        browser_name = None
        double_quotes = ''
        bash = ''
        if generic_utility.windows():
            path += 'windows/'
            ending = '.cmd'
            double_quotes = '"'
        elif generic_utility.darwin():
            path += 'darwin/'
            ending = '.sh'
            bash = 'sh '
        else:
            path += 'linux/'
            ending = '.sh'
            bash = 'sh '
        browser_name = self.get_browser_scriptname(browser_name)

        script = path + browser_name + ending

        if generic_utility.windows():
            script = script.replace('/', '\\')

        if not os.path.isfile(script):
            generic_utility.error('Script: ' + script + ' not found!')
            script = ''

        if generic_utility.darwin():
            script = bash + generic_utility.sh_escape(script)
        else:
            script = bash + double_quotes + script + double_quotes

        return script
Example #3
0
    def call_custom_script(self, name, params = ''):
        data_dir = generic_utility.data_dir()
        if not generic_utility.windows():
            bash = 'sh '
            ending = '.sh'
            double_quotes = ''
        else:
            bash = ''
            ending = '.cmd'
            double_quotes = '"'
        custom_script = data_dir + 'custom' + os.sep + name + ending

        if generic_utility.windows():
            custom_script = custom_script.replace('/','\\')

#        generic_utility.log('custom: '+custom_script)
        if os.path.isfile(custom_script):
            generic_utility.debug('calling: '+custom_script)
            if params != '':
                params = ' '+params
            if generic_utility.darwin():
                custom_script = generic_utility.sh_escape(custom_script)
            else:
                custom_script = double_quotes+custom_script+double_quotes

            self.call_script(bash+custom_script+params)
            return True

        return False
Example #4
0
    def call_custom_script(self, name, params=''):
        data_dir = generic_utility.data_dir()
        if not generic_utility.windows():
            bash = 'sh '
            ending = '.sh'
            double_quotes = ''
        else:
            bash = ''
            ending = '.cmd'
            double_quotes = '"'
        custom_script = data_dir + 'custom' + os.sep + name + ending

        if generic_utility.windows():
            custom_script = custom_script.replace('/', '\\')

#        generic_utility.log('custom: '+custom_script)
        if os.path.isfile(custom_script):
            generic_utility.debug('calling: ' + custom_script)
            if params != '':
                params = ' ' + params
            if generic_utility.darwin():
                custom_script = generic_utility.sh_escape(custom_script)
            else:
                custom_script = double_quotes + custom_script + double_quotes

            self.call_script(bash + custom_script + params)
            return True

        return False