当前位置: 首页>>代码示例>>Python>>正文


Python VFS.isdir方法代码示例

本文整理汇总了Python中VFS.isdir方法的典型用法代码示例。如果您正苦于以下问题:Python VFS.isdir方法的具体用法?Python VFS.isdir怎么用?Python VFS.isdir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在VFS的用法示例。


在下文中一共展示了VFS.isdir方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: shown

# 需要导入模块: import VFS [as 别名]
# 或者: from VFS import isdir [as 别名]
 def shown(self):
   self.engine.view.pushLayer(self.menu)
   shaders.checkIfEnabled()
   if not self.shownOnce:
     self.shownOnce = True
     if hasattr(sys, 'frozen'):
       # Check whether this is a release binary being run from an svn/git
       # working copy or whether this is an svn/git binary not being run
       # from an corresponding working copy.
       currentVcs, buildVcs = None, None
       if VFS.isdir('/gameroot/.git'):
         currentVcs = 'git'
       elif VFS.isdir('/gameroot/src/.svn'):
         currentVcs = 'Subversion'
       if 'git' in Version.version():
         buildVcs = 'git'
       elif 'svn' in Version.version():
         buildVcs = 'Subversion'
       if currentVcs != buildVcs:
         if buildVcs is None:
           msg = _('This binary release is being run from a %(currentVcs)s working copy. This is not the correct way to run FoFiX from %(currentVcs)s. Please see one of the following web pages to set your %(currentVcs)s working copy up correctly:') + \
                 '\n\nhttp://code.google.com/p/fofix/wiki/RunningUnderPython26' + \
                 '\nhttp://code.google.com/p/fofix/wiki/RequiredSourceModules'
         else:
           msg = _('This binary was built from a %(buildVcs)s working copy but is not running from one. The FoFiX Team will not provide any support whatsoever for this binary. Please see the following site for official binary releases:') + \
                 '\n\nhttp://code.google.com/p/fofix/'
         Dialogs.showMessage(self.engine, msg % {'buildVcs': buildVcs, 'currentVcs': currentVcs})
开发者ID:cherbib,项目名称:fofix,代码行数:29,代码来源:MainMenu.py

示例2: _getTagLine

# 需要导入模块: import VFS [as 别名]
# 或者: from VFS import isdir [as 别名]
def _getTagLine():
    import VFS  # can't be done at top level due to circular import issues...

    # Look for a git repository.
    if VFS.isdir("/gameroot/.git"):
        # HEAD is in the form "ref: refs/heads/master\n"
        headref = VFS.open("/gameroot/.git/HEAD").read()[5:].strip()
        if VFS.isfile("/gameroot/.git/" + headref):
            # The ref is in the form "sha1-hash\n"
            headhash = VFS.open("/gameroot/.git/" + headref).read().strip()
        else:
            # It's a packed ref.
            for line in VFS.open("/gameroot/.git/packed-refs"):
                if line.strip().endswith(headref):
                    headhash = line[:40]
                    break
        shortref = re.sub("^refs/(heads/)?", "", headref)
        return "development (git %s %s)" % (shortref, headhash[:7])

    # Look for the svn administrative directory.
    elif VFS.isdir("/gameroot/src/.svn"):
        revision = VFS.open("/gameroot/src/.svn/entries").readlines()[3].strip()
        return "development (svn r%s)" % revision

    else:
        return None
开发者ID:west2554,项目名称:fofix,代码行数:28,代码来源:Version.py

示例3: _getTagLine

# 需要导入模块: import VFS [as 别名]
# 或者: from VFS import isdir [as 别名]
def _getTagLine():
  import VFS  # can't be done at top level due to circular import issues...

  # Look for a git repository.
  if VFS.isdir('/gameroot/.git'):
    # HEAD is in the form "ref: refs/heads/master\n"
    headref = VFS.open('/gameroot/.git/HEAD').read()[5:].strip()
    # The ref is in the form "sha1-hash\n"
    headhash = VFS.open('/gameroot/.git/' + headref).read().strip()
    shortref = re.sub('^refs/(heads/)?', '', headref)
    return 'development (git %s %s)' % (shortref, headhash[:7])

  # Look for the svn administrative directory.
  elif VFS.isdir('/gameroot/src/.svn'):
    revision = VFS.open('/gameroot/src/.svn/entries').readlines()[3].strip()
    return 'development (svn r%s)' % revision

  else:
    return None
开发者ID:Gamer125,项目名称:fofix,代码行数:21,代码来源:Version.py

示例4: _getTagLine

# 需要导入模块: import VFS [as 别名]
# 或者: from VFS import isdir [as 别名]
def _getTagLine():
    import VFS  # can't be done at top level due to circular import issues...

    # Look for a git repository.
    if VFS.isdir('/gameroot/.git'):
        shortref = None
        headhash = None

        # HEAD is in the form "ref: refs/heads/master\n" if a branch is
        # checked out, or just the hash if HEAD is detached.
        refline = VFS.open('/gameroot/.git/HEAD').read().strip()

        if refline[0:5] == "ref: ":
            headref = refline[5:]
            if VFS.isfile('/gameroot/.git/' + headref):
                # The ref is in the form "sha1-hash\n"
                headhash = VFS.open('/gameroot/.git/' + headref).read().strip()
            else:
                # It's a packed ref.
                for line in VFS.open('/gameroot/.git/packed-refs'):
                    if line.strip().endswith(headref):
                        headhash = line[:40]
                        break
            shortref = re.sub('^refs/(heads/)?', '', headref)
        else:
            shortref = "(detached)"
            headhash = refline

        return 'development (git %s %s)' % (shortref or "(unknown)",
                                            headhash and headhash[:7] or "(unknown)")

    # Look for the svn administrative directory.
    elif VFS.isdir('/gameroot/src/.svn'):
        revision = VFS.open('/gameroot/src/.svn/entries').readlines()[3].strip()
        return 'development (svn r%s)' % revision

    else:
        return None
开发者ID:Richardgriff,项目名称:fofix,代码行数:40,代码来源:Version.py


注:本文中的VFS.isdir方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。