Пример #1
0
 def _getInstallPath():
     _installPath = requestData.get('installPath', None)
     if _installPath is None:
         userSelectedPath = os.path.dirname(_TKAskPath(subMod))
         fullInstallConfigs, errorMessage = gameScanner.scanUserSelectedPath(
             [subMod], userSelectedPath)
         _installPath = '' if not fullInstallConfigs else fullInstallConfigs[
             0].installPath
     return _installPath
Пример #2
0
def tryGetFullInstallConfig(subMod, installPath):
	# type: (SubModConfig, str) -> List[FullInstallConfiguration]
	fullInstallConfigs = None
	if os.path.isdir(installPath):
		fullInstallConfigs = gameScanner.scanForFullInstallConfigs([subMod], possiblePaths=[installPath])

	# If normal scan fails, then scan the path using the more in-depth 'scanUserSelectedPath(...)' function
	if not fullInstallConfigs:
		fullInstallConfigs, errorMessage = gameScanner.scanUserSelectedPath([subMod], installPath)
		print(errorMessage)

	return fullInstallConfigs
Пример #3
0
    def try_start_install(self, subMod, installPath, validateOnly):
        #type: (installConfiguration.SubModConfig, str, bool) -> (bool, installConfiguration.FullInstallConfiguration)
        import higurashiInstaller
        import uminekoInstaller
        import uminekoNScripterInstaller

        fullInstallConfigs = None
        if os.path.isdir(installPath):
            fullInstallConfigs = gameScanner.scanForFullInstallConfigs(
                [subMod], possiblePaths=[installPath])

        # If normal scan fails, then scan the path using the more in-depth 'scanUserSelectedPath(...)' function
        if not fullInstallConfigs:
            fullInstallConfigs, errorMessage = gameScanner.scanUserSelectedPath(
                [subMod], installPath)
            print(errorMessage)

        if validateOnly:
            return (True,
                    fullInstallConfigs[0]) if fullInstallConfigs else (False,
                                                                       '')
        else:
            if not fullInstallConfigs:
                raise Exception(
                    "Can't start install - No game found for mod [{}] at [{}]".
                    format(subMod.modName, installPath))

        fullInstallSettings = fullInstallConfigs[0]

        installerFunction = {
            "higurashi": higurashiInstaller.main,
            "umineko": uminekoInstaller.mainUmineko,
            "umineko_nscripter": uminekoNScripterInstaller.main
        }.get(fullInstallSettings.subModConfig.family, None)

        if not installerFunction:
            raise Exception(
                "Error - Unknown Game Family - I don't know how to install [{}] family of games. Please notify 07th-mod developers."
                .format(fullInstallSettings.subModConfig.family))

        # Prevent accidentally starting two installations at once
        if self.installAlreadyInProgress():
            raise Exception("Can't start install - installer already running.")

        def errorPrintingInstaller(args):
            try:
                installerFunction(args)
            except Exception as e:
                print('{}{}'.format(
                    common.Globals().INSTALLER_MESSAGE_ERROR_PREFIX, e))
                raise
            common.tryDeleteLockFile()

        # This lock file allows the installer to detect if there is already an install in progress in a different instance of the program
        # This lock file method is not foolproof, but should handle most cases
        # It is cleaned up when the install finishes (even if the install was unsuccessful), but is NOT cleaned up
        # if the program was force closed.
        common.tryCreateLockFile()

        self.threadHandle = threading.Thread(target=errorPrintingInstaller,
                                             args=(fullInstallSettings, ))
        self.threadHandle.setDaemon(
            True)  # Use setter for compatability with Python 2
        self.threadHandle.start()

        return (True, fullInstallSettings)