def create_prefix(prefix, wine_path=None, arch='win32'): """Create a new Wine prefix.""" logger.debug("Creating a %s prefix in %s", arch, prefix) # Avoid issue of 64bit Wine refusing to create win32 prefix # over an existing empty folder. if os.path.isdir(prefix) and not os.listdir(prefix): os.rmdir(prefix) if not wine_path: wine_path = wine().get_executable() wineboot_path = os.path.join(os.path.dirname(wine_path), 'wineboot') if not system.path_exists(wineboot_path): logger.error("No wineboot executable found in %s, your wine installation is most likely broken", wine_path) return env = { 'WINEARCH': arch, 'WINEPREFIX': prefix } system.execute([wineboot_path], env=env) for i in range(20): time.sleep(.25) if os.path.exists(os.path.join(prefix, 'user.reg')): break if not os.path.exists(os.path.join(prefix, 'user.reg')): logger.error('No user.reg found after prefix creation. ' 'Prefix might not be valid') return logger.info('%s Prefix created in %s', arch, prefix) prefix_manager = WinePrefixManager(prefix) prefix_manager.setup_defaults()
def create_prefix(prefix, wine_path=None, arch='win32'): """Create a new Wine prefix.""" logger.debug("Creating a %s prefix in %s", arch, prefix) # Avoid issue of 64bit Wine refusing to create win32 prefix # over an existing empty folder. if os.path.isdir(prefix) and not os.listdir(prefix): os.rmdir(prefix) if not wine_path: wine_path = wine().get_executable() wineboot_path = os.path.join(os.path.dirname(wine_path), 'wineboot') env = { 'WINEARCH': arch, 'WINEPREFIX': prefix } system.execute([wineboot_path], env=env) for i in range(20): time.sleep(.25) if os.path.exists(os.path.join(prefix, 'user.reg')): break if not os.path.exists(os.path.join(prefix, 'user.reg')): logger.error('No user.reg found after prefix creation. ' 'Prefix might not be valid') logger.info('%s Prefix created in %s', arch, prefix) prefix_manager = WinePrefixManager(prefix) prefix_manager.setup_defaults()
def prelaunch(self): if not os.path.exists(os.path.join(self.prefix_path, 'user.reg')): create_prefix(self.prefix_path, arch=self.wine_arch) prefix_manager = WinePrefixManager(self.prefix_path) prefix_manager.setup_defaults() prefix_manager.configure_joypads() self.set_regedit_keys() return True
def create_prefix(prefix, wine_path=None, arch='win32', overrides={}, install_gecko=None, install_mono=None): """Create a new Wine prefix.""" logger.debug("Creating a %s prefix in %s", arch, prefix) # Avoid issue of 64bit Wine refusing to create win32 prefix # over an existing empty folder. if os.path.isdir(prefix) and not os.listdir(prefix): os.rmdir(prefix) if not wine_path: wine = import_runner('wine') wine_path = wine().get_executable() if not wine_path: logger.error("Wine not found, can't create prefix") return wineboot_path = os.path.join(os.path.dirname(wine_path), 'wineboot') if not system.path_exists(wineboot_path): logger.error( "No wineboot executable found in %s, " "your wine installation is most likely broken", wine_path) return if install_gecko == 'False': overrides['mshtml'] = 'disabled' if install_mono == 'False': overrides['mscoree'] = 'disabled' wineenv = { 'WINEARCH': arch, 'WINEPREFIX': prefix, 'WINEDLLOVERRIDES': get_overrides_env(overrides) } system.execute([wineboot_path], env=wineenv) for loop_index in range(50): time.sleep(.25) if system.path_exists(os.path.join(prefix, 'user.reg')): break if loop_index == 20: logger.warning( "Wine prefix creation is taking longer than expected...") if not os.path.exists(os.path.join(prefix, 'user.reg')): logger.error('No user.reg found after prefix creation. ' 'Prefix might not be valid') return logger.info('%s Prefix created in %s', arch, prefix) prefix_manager = WinePrefixManager(prefix) prefix_manager.setup_defaults()
def create_prefix(prefix, wine_path=None, arch='win32', overrides={}, install_gecko=None, install_mono=None): """Create a new Wine prefix.""" logger.debug("Creating a %s prefix in %s", arch, prefix) # Avoid issue of 64bit Wine refusing to create win32 prefix # over an existing empty folder. if os.path.isdir(prefix) and not os.listdir(prefix): os.rmdir(prefix) if not wine_path: wine_path = wine().get_executable() wineboot_path = os.path.join(os.path.dirname(wine_path), 'wineboot') if not system.path_exists(wineboot_path): logger.error("No wineboot executable found in %s, " "your wine installation is most likely broken", wine_path) return if install_gecko is 'False': overrides['mshtml'] = 'disabled' if install_mono is 'False': overrides['mscoree'] = 'disabled' wineenv = { 'WINEARCH': arch, 'WINEPREFIX': prefix, 'WINEDLLOVERRIDES': get_overrides_env(overrides) } system.execute([wineboot_path], env=wineenv) for i in range(20): time.sleep(.25) if os.path.exists(os.path.join(prefix, 'user.reg')): break if not os.path.exists(os.path.join(prefix, 'user.reg')): logger.error('No user.reg found after prefix creation. ' 'Prefix might not be valid') return logger.info('%s Prefix created in %s', arch, prefix) prefix_manager = WinePrefixManager(prefix) prefix_manager.setup_defaults()
def prelaunch(self): prefix_manager = WinePrefixManager(self.prefix_path) prefix_manager.setup_defaults() prefix_manager.configure_joypads() self.set_regedit_keys() return True