コード例 #1
0
ファイル: legojam.py プロジェクト: le717/PatchIt
def BuildJAM(jam_files):
    """Compress the files into LEGO.JAM"""
    try:
        os.chdir(jam_files)
        JAMExtractor.build(jam_files, verbose=False)

    # We don't have the rights to compress the JAM
    except PermissionError:  # lint:ok
        logging.warning("Error number '13'")
        logging.exception('''Oops! Something went wrong! Here's what happened

''', exc_info=True)
        logging.warning('''

PatchIt! does not have the rights to save LEGO.JAM to
{0}
'''.format(jam_files))

        # User did not want to reload with Administrator rights
        if not runasadmin.AdminRun().launch(
            ['''PatchIt! does not have the rights to save LEGO.JAM to
{0}'''.format(jam_files)]):
            # Do nothing, go to main menu
            pass

    # Go back to the menu
    finally:
        os.chdir(const.app_folder)
        main()
コード例 #2
0
ファイル: legojam.py プロジェクト: le717/PatchIt
def ExtractJAM(jam_location):
    """Extract the files from LEGO.JAM"""
    try:
        # Extract the JAM archive
        JAMExtractor.extract(jam_location, verbose=False)

    # We don't have the rights to extract the JAM
    except PermissionError:  # lint:ok
        logging.warning("Error number '13'")
        logging.exception('''Oops! Something went wrong! Here's what happened

''', exc_info=True)
        logging.warning('''

PatchIt! does not have the rights to extract LEGO.JAM to
{0}
'''.format(jam_location))

        # User did not want to reload with Administrator rights
        if not runasadmin.AdminRun().launch(
            ['''PatchIt! does not have the rights to extract LEGO.JAM to
{0}'''.format(jam_location)]):
            # Do nothing, go to main menu
            pass

    # Go back to the menu
    finally:
        main()