Пример #1
0
def get_faceTrackNoIR_path():
    """Get the path to FaceTrackNoIR installation."""

    fake_path = devmode.get_facetracknoir_path()
    if fake_path:
        return fake_path

    try:
        key = 'SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\FaceTrackNoIR_is1'
        reg_val = Registry.ReadValueUserAndMachine(key, 'InstallLocation',
                                                   True)

        Logger.info('FaceTrackNoIR: Install location: {}'.format(reg_val))

        path = os.path.join(reg_val, 'FaceTrackNoIR.exe')
        if not os.path.isfile(path):
            Logger.info(
                'FaceTrackNoIR: Found install location but no expected exe file found: {}'
                .format(path))
            raise FaceTrackNoIRNotInstalled()

        return path

    except Registry.Error:
        raise FaceTrackNoIRNotInstalled()
def get_opentrack_path():
    """Get the path to Opentrack installation."""

    fake_path = devmode.get_opentrack_path()
    if fake_path:
        return fake_path

    try:
        key = 'SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{63F53541-A29E-4B53-825A-9B6F876A2BD6}_is1'
        reg_val = Registry.ReadValueUserAndMachine(key, 'InstallLocation',
                                                   True)

        Logger.info('Opentrack: Install location: {}'.format(reg_val))

        path = os.path.join(reg_val, 'opentrack.exe')
        if not os.path.isfile(path):
            Logger.info(
                'Opentrack: Found install location but no expected exe file found: {}'
                .format(path))
            raise OpentrackNotInstalled()

        return path

    except Registry.Error:
        raise OpentrackNotInstalled()
Пример #3
0
    def get_installation_path():
        """Return the folder where Arma is installed.

        1) Check local directory
        2) Search the registry entry
        3) Browse steam libraries in search for Arma

        Raises ArmaNotInstalled if the required registry keys cannot be found."""

        if Arma.installation_path_cached:
            return Arma.installation_path_cached

        if devmode.get_arma_path():
            Arma.installation_path_cached = devmode.get_arma_path()
            return Arma.installation_path_cached

        # 1) Check local directory
        path = paths.get_external_executable_dir()

        if os.path.isfile(os.path.join(path, 'Arma3.exe')):
            Logger.info('Arma: Arma3.exe found in launcher directory: {}'.format(path))
            Arma.installation_path_cached = path
            return Arma.installation_path_cached

        Logger.error('Arma: Could not find Arma3.exe in launcher directory')

        # 2) Search the registry entry
        try:
            path = Registry.ReadValueUserAndMachine(Arma._arma_registry_path, 'main', check_both_architectures=True)

            if os.path.isfile(os.path.join(path, 'Arma3.exe')):
                Logger.info('Arma: Arma3.exe found through registry: {}'.format(path))

                Arma.installation_path_cached = path
                return Arma.installation_path_cached

            else:
                Logger.error('Arma: Could not find Arma3.exe at the location pointed by the registry: {}'.format(path))

        except Registry.Error:
            Logger.error('Arma: Could not find registry entry for installation path')

        # 3) Browse steam libraries in search for Arma
        steam_libraries = steam.find_steam_libraries()

        for library in steam_libraries:
            path = os.path.join(library, 'steamapps', 'common', 'Arma 3')

            if os.path.isfile(os.path.join(path, 'Arma3.exe')):
                Logger.info('Arma: Arma3.exe found in Steam libraries: {}'.format(path))
                Arma.installation_path_cached = path
                return Arma.installation_path_cached

        # All failed :(
        raise ArmaNotInstalled()
Пример #4
0
def get_steam_exe_path():
    """Return the path to the steam executable.

    Raises SteamNotInstalled if steam is not installed."""

    if devmode.get_steam_executable():
        return devmode.get_steam_executable()

    try:
        # Optionally, there is also SteamPath
        return Registry.ReadValueUserAndMachine(
            _steam_registry_path, 'SteamExe',
            check_both_architectures=True)  # SteamPath

    except Registry.Error:
        raise SteamNotInstalled()
Пример #5
0
def get_TrackIR_path():
    """Get the path to FaceTrackNoIR installation."""

    fake_path = devmode.get_trackir_path()
    if fake_path:
        return fake_path

    try:
        key = 'Software\\NaturalPoint\\NaturalPoint\\NPClient Location'
        reg_val = Registry.ReadValueUserAndMachine(key, 'Path', True)

        Logger.info('TrackIR: Install location: {}'.format(reg_val))

        path = os.path.join(reg_val, 'TrackIR5.exe')
        if not os.path.isfile(path):
            Logger.info(
                'TrackIR: Found install location but no expected exe file found: {}'
                .format(path))
            raise TrackIRNotInstalled()

        return path

    except Registry.Error:
        raise TrackIRNotInstalled()