Beispiel #1
0
def load_xxnet():
    sdcard_path = get_sdcard_path()
    if not os.path.exists(sdcard_path):
        print("sdcard path can't access:%s" % sdcard_path)
        return

    xxnet_path = os.path.join(sdcard_path, "XX-Net")
    print "load_xxnet on:", xxnet_path
    if not os.path.exists(xxnet_path):
        os.mkdir(xxnet_path)

    launcher_path = os.path.join(xxnet_path, "code", "default", "launcher")
    if not os.path.exists(launcher_path):
        default_zip = os.path.join(current_path, "default.zip")
        with zipfile.ZipFile(default_zip, "r") as dz:
            dz.extractall(xxnet_path)

    sys.path.insert(0, launcher_path)

    #add by outofmemo, fix update fail for Android
    version_path = os.path.join(xxnet_path, "code" , "version.txt")
    if os.path.isfile(version_path):
        version_file = open(version_path)
        version_name = version_file.read()
        sys.path.insert(0, os.path.join(xxnet_path, "code", version_name, "launcher"))
        version_file.close()
        
    from start import main as launcher_main
    print "launcher_main"
    launcher_main()
Beispiel #2
0
def main():
    create_data_path()

    launcher_version = get_launcher_version_from_config()
    if not launcher_version:
        launcher_version = scan_launcher_version()
    launcher_path = os.path.join(current_path, launcher_version)
    sys.path.insert(0, launcher_path)
    from start import main as launcher_main
    launcher_main()
Beispiel #3
0
def main():
    create_data_path()

    launcher_version = get_launcher_version_from_config()
    if not launcher_version or not os.path.isdir(os.path.join(current_path, launcher_version)):
        launcher_version = scan_launcher_version()
    print "launcher version:", launcher_version
    launcher_path = os.path.join(current_path, launcher_version)
    sys.path.insert(0, launcher_path)
    from start import main as launcher_main
    launcher_main()
Beispiel #4
0
def load_xxnet():
    sdcard_path = get_sdcard_path()
    if not os.path.exists(sdcard_path):
        print("sdcard path can't access:%s" % sdcard_path)
        return

    xxnet_path = os.path.join(sdcard_path, "XX-Net")
    version_fn = os.path.join(xxnet_path, "code", "version.txt")
    print "load_xxnet on:", xxnet_path

    default_zip = os.path.join(current_path, "default.zip")
    if not os.path.exists(xxnet_path) or \
        os.path.getmtime(xxnet_path) < os.path.getmtime(default_zip):
        if not os.path.exists(xxnet_path):
            os.mkdir(xxnet_path)
        os.utime(xxnet_path, None)  # touch the dir mtime.

        print "unzip %s to %s." % (default_zip, xxnet_path)
        with zipfile.ZipFile(default_zip, "r") as dz:
            dz.extractall(xxnet_path)

        if os.path.exists(version_fn):
            os.remove(version_fn)

    version = "default"
    if os.path.exists(version_fn):
        with open(version_fn, "rt") as fd:
            version = fd.readline()

    if not os.path.exists(os.path.join(xxnet_path, "code", version,
                                       "launcher")):
        print "version %s not exist, use default." % version
        version = "default"
    else:
        print "launch version:%s" % version

    launcher_path = os.path.join(xxnet_path, "code", version, "launcher")
    sys.path.insert(0, launcher_path)

    from start import main as launcher_main
    print "launcher_main"
    launcher_main()
Beispiel #5
0
def load_xxnet():
    xxnet_path = current_path
    version_fn = os.path.join(xxnet_path, "code", "version.txt")
    LOGGER.info("load_xxnet on:%s" % xxnet_path)
    version = "default"
    if os.path.exists(version_fn):
        with open(version_fn, "rt") as fd:
            version = fd.readline().strip()

    if not os.path.exists(os.path.join(xxnet_path, "code", version, "launcher")):
        LOGGER.error("version %s not exist, use default." % version)
        version = "default"
    else:
        LOGGER.info("launch version:%s" % version)

    launcher_path = os.path.join(xxnet_path, "code", version, "launcher")
    sys.path.insert(0, launcher_path)

    from start import main as launcher_main
    launcher_main()
Beispiel #6
0
def load_xxnet():
    sdcard_path = get_sdcard_path()
    if not os.path.exists(sdcard_path):
        print("sdcard path can't access:%s" % sdcard_path)
        return

    xxnet_path = os.path.join(sdcard_path, "XX-Net")
    version_fn = os.path.join(xxnet_path, "code", "version.txt")
    print "load_xxnet on:", xxnet_path

    default_zip = os.path.join(current_path, "default.zip")
    if not os.path.exists(xxnet_path) or \
        os.path.getmtime(xxnet_path) < os.path.getmtime(default_zip):
        if not os.path.exists(xxnet_path):
            os.mkdir(xxnet_path)
        os.utime(xxnet_path, None) # touch the dir mtime.

        print "unzip %s to %s." % (default_zip, xxnet_path)
        with zipfile.ZipFile(default_zip, "r") as dz:
            dz.extractall(xxnet_path)

        if os.path.exists(version_fn):
            os.remove(version_fn)

    version = "default"
    if os.path.exists(version_fn):
        with open(version_fn, "rt") as fd:
            version = fd.readline()

    if not os.path.exists(os.path.join(xxnet_path, "code", version, "launcher")):
        print "version %s not exist, use default." % version
        version = "default"
    else:
        print "launch version:%s" % version

    launcher_path = os.path.join(xxnet_path, "code", version, "launcher")
    sys.path.insert(0, launcher_path)

    from start import main as launcher_main
    print "launcher_main"
    launcher_main()
Beispiel #7
0
def load_xxnet():
    sdcard_path = get_sdcard_path()
    if not os.path.exists(sdcard_path):
        print("sdcard path can't access:%s" % sdcard_path)
        return

    xxnet_path = os.path.join(sdcard_path, "XX-Net")
    print "load_xxnet on:", xxnet_path
    if not os.path.exists(xxnet_path):
        os.mkdir(xxnet_path)

    launcher_path = os.path.join(xxnet_path, "code", "default", "launcher")
    if not os.path.exists(launcher_path):
        default_zip = os.path.join(current_path, "default.zip")
        with zipfile.ZipFile(default_zip, "r") as dz:
            dz.extractall(xxnet_path)

    sys.path.insert(0, launcher_path)
    from start import main as launcher_main
    print "launcher_main"
    launcher_main()
Beispiel #8
0
def load_xxnet():
    sdcard_path = get_sdcard_path()
    if not os.path.exists(sdcard_path):
        print("sdcard path can't access:%s" % sdcard_path)
        return

    xxnet_path = os.path.join(sdcard_path, "XX-Net")
    print "load_xxnet on:", xxnet_path
    if not os.path.exists(xxnet_path):
        os.mkdir(xxnet_path)

    launcher_path = os.path.join(xxnet_path, "launcher")
    if not os.path.exists(launcher_path):
        default_zip = os.path.join(current_path, "default.zip")
        with zipfile.ZipFile(default_zip, "r") as dz:
            dz.extractall(xxnet_path)

    sys.path.insert(0, launcher_path)
    from start import main as launcher_main
    print "launcher_main"
    launcher_main()