Пример #1
0
    def get_bin_tool(self, name, win_ext=''):
        """Returns the full path to the @name tool in the SDK's bin dir.

        @name
          The tool's name.
        @win_ext
          Extension to append to @name in Windows.
        """
        name = join_on_win(name, win_ext)
        return os.path.realpath(os.path.join(self.path_to_bin_dir, name))
Пример #2
0
    def get_bin_tool(self, name, win_ext=''):
        """Returns the full path to the @name tool in the SDK's bin dir.

        @name
          The tool's name.
        @win_ext
          Extension to append to @name in Windows.
        """
        name = join_on_win(name, win_ext)
        return os.path.realpath(os.path.join(self.path_to_bin_dir, name))
Пример #3
0
 def validate_sdk_path(self, value):
     try:
         expanded = os.path.expandvars(os.path.expanduser(value))
     except:
         raise FatalConfigError(
             'cannot resolve configured "%s" path to sdk folder: %s' % (self.name, value))
     else:
         full_path = os.path.join(expanded, 'bin',
                 join_on_win('dart', '.exe'))
         if not os.path.exists(full_path):
             raise FatalConfigError(
                 'configured "%s" folder does not contain dart binary: %s' % (self.name, value))
         return expanded
Пример #4
0
    def __init__(self):
        self.setts = sublime.load_settings('Dart - Plugin Settings.sublime-settings')

        try:
            p = os.path.expandvars(os.path.expanduser(self.setts.get('dart_sdk_path')))
            if not os.path.exists(
                os.path.join(p, 'bin', join_on_win('dart', '.exe'))):
                    msg = 'wrong path in dart_sdk_path: {}'.format(p)
                    raise FatalConfigError(msg)
            self._path = p

        except (TypeError, AttributeError):
            msg = 'invalid value of dart_sdk_path: {}'.format(p)
            raise FatalConfigError(msg)
Пример #5
0
 def validate_sdk_path(self, value):
     try:
         expanded = os.path.expandvars(os.path.expanduser(value))
     except:
         raise FatalConfigError(
             'cannot resolve configured "%s" path to sdk folder: %s' %
             (self.name, value))
     else:
         full_path = os.path.join(expanded, 'bin',
                                  join_on_win('dart', '.exe'))
         if not os.path.exists(full_path):
             raise FatalConfigError(
                 'configured "%s" folder does not contain dart binary: %s' %
                 (self.name, value))
         return expanded
Пример #6
0
    def __init__(self):
        self.setts = sublime.load_settings('Dart - Plugin Settings.sublime-settings')

        path = self.setts.get('dart_sdk_path')
        if not path:
            raise FatalConfigError('missing "dart_sdk_path" setting')

        path = os.path.expandvars(os.path.expanduser(path))
        try:
            if not os.path.exists(
                os.path.join(path, 'bin', join_on_win('dart', '.exe'))):
                    msg = 'wrong path in "dart_sdk_path": {}'.format(path)
                    raise FatalConfigError(msg)
            self._path = path
        except Exception:
            msg = 'invalid value of "dart_sdk_path": {}'.format(p or '(none)')
            raise FatalConfigError(msg)
Пример #7
0
    def __init__(self):
        self.setts = sublime.load_settings(
            'Dart - Plugin Settings.sublime-settings')

        path = self.setts.get('dart_sdk_path')
        if not path:
            raise FatalConfigError('missing "dart_sdk_path" setting')

        path = os.path.expandvars(os.path.expanduser(path))
        try:
            if not os.path.exists(
                    os.path.join(path, 'bin', join_on_win('dart', '.exe'))):
                msg = 'wrong path in "dart_sdk_path": {}'.format(path)
                raise FatalConfigError(msg)
            self._path = path
        except Exception:
            msg = 'invalid value of "dart_sdk_path": {}'.format(p or '(none)')
            raise FatalConfigError(msg)
Пример #8
0
 def testDoesNotAppendPathFragment(self):
     actual = join_on_win('foo', 'bar')
     self.assertEqual('foo', actual)
Пример #9
0
 def testAppendsExtensionOnWindows(self):
     actual = join_on_win('foo', '.exe')
     self.assertEqual('foo.exe', actual)