예제 #1
0
def dota_path_default():
    
    steam = Settings().get(Settings.STEAM_PATH_KEY)
    dota_loc = [steam, "SteamApps", "common"]
    for p in ["dota 2", "dota 2 beta"]:
        if exists("/".join(dota_loc + [p])): return normpath("/".join(dota_loc + [p]))
    
    Settings.dota_missing = True
    log.CRITICAL("No dota2 folder found! Please install it or adjust the settings!")
    return ""
예제 #2
0
def steam_path_default():
    path = ""
    if os.name == "nt":
        path = str(QSettings("HKEY_CURRENT_USER\\Software\\Valve\\Steam", QSettings.NativeFormat).value("SteamPath", "").toString())
    elif sys.platform == "darwin":
        path = expanduser("~/Library/Application Support/Steam")
    else:
        path = expanduser("~/.steam/steam")
    if not exists(path): 
        log.CRITICAL("No Steam folder found! Please install it or adjust the settings!")
        Settings.steam_missing = True
    return normpath(path)
예제 #3
0
    def _extract_mod_version(self, addon_dir):

        log.DEBUG("Found mod %s, detecting version..." % (addon_dir))
        file_path = join(self._d2mp_path(), join(addon_dir, "addoninfo.txt"))
        if not isfile(file_path):
            log.DEBUG("no addoninfo file found: %s" % (file_path))
            return "0.0.1"
        regex = "(addonversion\s+)(\d+\.\d+\.\d+)"
        res = re.search(regex, get_file_content(file_path))
        if res is not None:
            return res.group(2)
        else:
            log.CRITICAL("could not extract version number with regex: %s" %
                         (regex))
            return "0.0.1"
예제 #4
0
 def _command_not_found(self, content):
     log.CRITICAL("could not found the right command: %s!" %
                  (content.get("msg")))
예제 #5
0
 def _wrong_content(self, content):
     log.CRITICAL("haven't expect the content: %s!" % (content))