def goglib_unpack_game(self, game_name):
if not self.queue_tab_exists():
self.append_queue_tab()
if not os.path.exists(self.goglib_install_dir):
os.makedirs(self.goglib_install_dir)
if not os.path.exists(self.goglib_install_dir + '/' + game_name):
os.makedirs(self.goglib_install_dir + '/' + game_name)
self.progressbar_goglib.set_text(_("Installing..."))
files_list = os.listdir(self.goglib_download_dir + '/' + game_name)
files_list = sorted(files_list)
self.installer_type = 'none'
number_of_installers = 0
versions = []
for line in files_list:
if '.sh' in line:
self.installer_type = 'sh'
versions.append(line)
number_of_installers += 1
elif '.exe' in line:
self.installer_type = 'exe'
versions.append(line)
number_of_installers += 1
versions = sorted(versions)
if number_of_installers > 0:
if self.installer_type == 'sh':
command = ['unzip', '-o', \
self.goglib_download_dir + '/' + game_name + '/' + versions[-1], \
'-d', self.goglib_install_dir + '/' + game_name + '/tmp']
elif self.installer_type == 'exe':
command = ['innoextract', '--gog', \
self.goglib_download_dir + '/' + game_name + '/' + versions[-1], \
'-d', self.goglib_install_dir + '/' + game_name + '/tmp']
elif number_of_installers == 0:
self.goglib_install_game(goglib_installation_queue[0])
return
goglib_name_to_pid_unpack_dict[game_name], stdin, stdout, stderr = GLib.spawn_async(command,
flags=GLib.SpawnFlags.SEARCH_PATH|GLib.SpawnFlags.DO_NOT_REAP_CHILD,
standard_output=True,
standard_error=True)
io = GLib.IOChannel(stdout)
self.source_id_out = io.add_watch(GLib.IO_IN|GLib.IO_HUP,
self.watch_process,
'goglib_unpack_game',
priority=GLib.PRIORITY_HIGH)
评论列表
文章目录