From ad5cda80cb8a37851d645b81a9c8ebd24e561af3 Mon Sep 17 00:00:00 2001 From: gryf Date: Sat, 17 Feb 2018 11:27:11 +0100 Subject: [PATCH] Removed load/save for state Since loading/saving state for e-uae seems not working anymore, methods for keeping saves in a place was removed. --- e_uae_wrapper/archive.py | 9 ----- e_uae_wrapper/base.py | 83 ---------------------------------------- 2 files changed, 92 deletions(-) diff --git a/e_uae_wrapper/archive.py b/e_uae_wrapper/archive.py index a6dd209..ad8b1bf 100644 --- a/e_uae_wrapper/archive.py +++ b/e_uae_wrapper/archive.py @@ -35,18 +35,12 @@ class Wrapper(base.ArchiveBase): if not self._extract(): return False - self._load_save() - if not self._copy_conf(): return False if not self._run_emulator(): return False - if self._get_saves_dir(): - if not self._save_save(): - return False - return self._make_archive() def _make_archive(self): @@ -59,9 +53,6 @@ class Wrapper(base.ArchiveBase): curdir = os.path.abspath('.') os.chdir(self.dir) - saves = self._get_saves_dir() - if saves: - shutil.rmtree(saves) os.unlink('.uaerc') title = self._get_title() diff --git a/e_uae_wrapper/base.py b/e_uae_wrapper/base.py index b82b646..f6b5d0e 100644 --- a/e_uae_wrapper/base.py +++ b/e_uae_wrapper/base.py @@ -60,21 +60,6 @@ class Base(object): shutil.rmtree(self.dir) return - def _set_assets_paths(self): - """ - Set full paths for archive file (without extension) and for save state - archive file - """ - conf_abs_dir = os.path.dirname(os.path.abspath(self.conf_file)) - conf_base = os.path.basename(self.conf_file) - conf_base = os.path.splitext(conf_base)[0] - - # set optional save_state - arch_ext = utils.get_arch_ext(self.config.get('wrapper_archiver')) - if arch_ext: - self.save_filename = os.path.join(conf_abs_dir, conf_base + - '_save' + arch_ext) - def _copy_conf(self): """copy provided configuration as .uaerc""" curdir = os.path.abspath('.') @@ -108,74 +93,6 @@ class Base(object): title = self.config['wrapper_archive'] return title - def _save_save(self): - """ - Get the saves from emulator and store it where configuration is placed - """ - if self.config.get('wrapper_save_state', '0') != '1': - return True - - os.chdir(self.dir) - save_path = self._get_saves_dir() - if not save_path: - return True - - if os.path.exists(self.save_filename): - os.unlink(self.save_filename) - - curdir = os.path.abspath('.') - - if not utils.create_archive(self.save_filename, '', [save_path]): - logging.error('Error: archiving save state failed.') - os.chdir(curdir) - return False - - os.chdir(curdir) - return True - - def _load_save(self): - """ - Put the saves (if exists) to the temp directory. - """ - if self.config.get('wrapper_save_state', '0') != '1': - return True - - if not os.path.exists(self.save_filename): - return True - - curdir = os.path.abspath('.') - os.chdir(self.dir) - utils.extract_archive(self.save_filename) - os.chdir(curdir) - return True - - def _get_saves_dir(self): - """ - Return path to save state directory or None in cases: - - there is no save state dir set relative to copied config file - - save state dir is set globally - - save state dir is set relative to the config file - - save state dir doesn't exists - Note, that returned path is relative not absolute - """ - if not self.config.get('save_states_dir'): - return None - - if self.config['save_states_dir'].startswith('$WRAPPER') and \ - '..' not in self.config['save_states_dir']: - save = self.config['save_states_dir'].replace('$WRAPPER/', '') - else: - return None - - save_path = os.path.join(self.dir, save) - if not os.path.exists(save_path) or not os.path.isdir(save_path): - return None - - if save.endswith('/'): - save = save[:-1] - - return save - def _interpolate_options(self): """ Search and replace values for options which contains {{ and }}