Python sublime 模块,cache_path() 实例源码

我们从Python开源项目中,提取了以下9个代码示例,用于说明如何使用sublime.cache_path()

项目:sublime-text-3-packages    作者:nickjj    | 项目源码 | 文件源码
def clear_cache(force = False):
  """
  If the folder exists, and has more than 5MB of icons in the cache, delete
  it to clear all the icons then recreate it.
  """
  from os.path import getsize, join, isfile, exists
  from os import makedirs, listdir
  from sublime import cache_path
  from shutil import rmtree

  # The icon cache path
  icon_path = join(cache_path(), "GutterColor")

  # The maximum amount of space to take up
  limit = 5242880 # 5 MB

  if exists(icon_path):
    size = sum(getsize(join(icon_path, f)) for f in listdir(icon_path) if isfile(join(icon_path, f)))
    if force or (size > limit): rmtree(icon_path)

  if not exists(icon_path): makedirs(icon_path)
项目:sublime-text-3-packages    作者:nickjj    | 项目源码 | 文件源码
def icon_path(self):
    """Returns the absolute path to the icons"""
    return join(cache_path(), 'GutterColor', '%s.png' % self.color())
项目:SwiftKitten    作者:johncsnyder    | 项目源码 | 文件源码
def _get_cache_path(cls):
        """
        """
        return os.path.join(sublime.cache_path(), "SwiftKitten")
项目:SwiftKitten    作者:johncsnyder    | 项目源码 | 文件源码
def _save_framework_cache(cls):
        """
        """
        cache_path = cls._get_cache_path()

        if not os.path.exists(cache_path):
            os.mkdir(cache_path)

        framework_cache_path = os.path.join(cache_path, "frameworks.cache")

        with open(framework_cache_path, "wb") as f:
            pickle.dump(cls.framework_cache, f)
项目:docphp    作者:garveen    | 项目源码 | 文件源码
def getDocphpPath():
    return sublime.cache_path() + '/' + package_name + '/'
项目:SublimeGotoUsage    作者:syko    | 项目源码 | 文件源码
def get_cache_dir():
    path = os.path.join(sublime.cache_path(), 'GotoUsage')
    if not os.path.exists(path):
        os.mkdir(path)
    return path
项目:PyTest    作者:kaste    | 项目源码 | 文件源码
def get_report_file():
    path = os.path.join(sublime.cache_path(), 'PyTest')
    if not os.path.isdir(path):
        os.makedirs(path)
    return os.path.join(path, 'last-run.xml')
项目:sublime-favorites    作者:oleg-shilo    | 项目源码 | 文件源码
def panel_file():

    plugin_dir = ''

    if hasattr(sublime, 'cache_path'):
        plugin_dir = sublime.cache_path()
    else:
        plugin_dir = 'cache'
        plugin_dir = os.path.join(os.getcwd(), plugin_dir)

    data_dir = path.join(plugin_dir, panel_name)
    if not path.exists(data_dir):
        os.makedirs(data_dir)
    return path.join(data_dir, panel_name)
# -----------------
项目:RemoteCpp    作者:ruibm    | 项目源码 | 文件源码
def plugin_dir():
  return os.path.join(sublime.cache_path(), 'RemoteCpp')