mirror of
https://github.com/gryf/fs-uae-wrapper.git
synced 2026-01-31 13:05:52 +01:00
Make wrapper_archiver option mandatory in savestare module
This commit is contained in:
12
README.rst
12
README.rst
@@ -245,19 +245,16 @@ savestate
|
|||||||
Options used:
|
Options used:
|
||||||
|
|
||||||
* ``wrapper`` (required) with ``archive`` as an value
|
* ``wrapper`` (required) with ``archive`` as an value
|
||||||
* ``wrapper_archiver`` (conditionally required) archiver to use for storage
|
* ``wrapper_archiver`` (required) archiver to use for storage save state
|
||||||
save state
|
|
||||||
* ``wrapper_gui_msg`` (optional) if set to "1", will display a graphical
|
* ``wrapper_gui_msg`` (optional) if set to "1", will display a graphical
|
||||||
message during extracting files
|
message during extracting files
|
||||||
* ``wrapper_save_state`` (optional) if set to "1", will archive save state
|
|
||||||
directory, defined as ``$CONFIG/[save-state-dir-name]`` using provided
|
|
||||||
``wrapper_archiver`` archiver. If this option is enabled,
|
|
||||||
``wrapper_archiver`` will be required.
|
|
||||||
|
|
||||||
This module is primarily used to run emulator with read only media attached
|
This module is primarily used to run emulator with read only media attached
|
||||||
(like images of floppies or uncompressed CD-ROMs) and its purpose is to
|
(like images of floppies or uncompressed CD-ROMs) and its purpose is to
|
||||||
preserve save state which will be created as an archive alongside with original
|
preserve save state which will be created as an archive alongside with original
|
||||||
configuration file in selected archive format.
|
configuration file in selected archive format. Note, that there is required to
|
||||||
|
provide ``wrapper_archiver``, since option ``wrapper_save_state`` is implicitly
|
||||||
|
set to value ``1`` in this module.
|
||||||
|
|
||||||
Example configuration:
|
Example configuration:
|
||||||
|
|
||||||
@@ -268,7 +265,6 @@ Example configuration:
|
|||||||
wrapper = savestate
|
wrapper = savestate
|
||||||
wrapper_archiver = 7z
|
wrapper_archiver = 7z
|
||||||
wrapper_gui_msg = 1
|
wrapper_gui_msg = 1
|
||||||
wrapper_save_state = 1
|
|
||||||
...
|
...
|
||||||
|
|
||||||
And execution is as usual:
|
And execution is as usual:
|
||||||
|
|||||||
@@ -8,6 +8,19 @@ class SaveState(base.Base):
|
|||||||
"""
|
"""
|
||||||
Preserve save state.
|
Preserve save state.
|
||||||
"""
|
"""
|
||||||
|
def __init__(self, conf_file, fsuae_options, configuration):
|
||||||
|
"""
|
||||||
|
Params:
|
||||||
|
conf_file: a relative path to provided configuration file
|
||||||
|
fsuae_options: is an CmdOption object created out of command line
|
||||||
|
parameters
|
||||||
|
configuration: is config dictionary created out of config file
|
||||||
|
"""
|
||||||
|
super(SaveState, self).__init__(conf_file, fsuae_options,
|
||||||
|
configuration)
|
||||||
|
self.arch_filepath = None
|
||||||
|
self.all_options['wrapper_save_state'] = '1'
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
"""
|
"""
|
||||||
Main function which accepts configuration file for FS-UAE
|
Main function which accepts configuration file for FS-UAE
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class TestArchive(TestCase):
|
|||||||
arch = savestate.SaveState('Config.fs-uae', utils.CmdOption(), {})
|
arch = savestate.SaveState('Config.fs-uae', utils.CmdOption(), {})
|
||||||
self.assertFalse(arch.run())
|
self.assertFalse(arch.run())
|
||||||
|
|
||||||
arch.all_options = {'wrapper': 'archive',
|
arch.all_options = {'wrapper': 'savestate',
|
||||||
'wrapper_save_state': '1',
|
'wrapper_save_state': '1',
|
||||||
'wrapper_archiver': 'rar'}
|
'wrapper_archiver': 'rar'}
|
||||||
|
|
||||||
@@ -70,3 +70,16 @@ class TestArchive(TestCase):
|
|||||||
|
|
||||||
save_state.return_value = True
|
save_state.return_value = True
|
||||||
self.assertTrue(arch.run())
|
self.assertTrue(arch.run())
|
||||||
|
|
||||||
|
@mock.patch('fs_uae_wrapper.path.which')
|
||||||
|
def test_validate_options(self, which):
|
||||||
|
which.return_value = 'unrar'
|
||||||
|
|
||||||
|
arch = savestate.SaveState('Config.fs-uae', utils.CmdOption(), {})
|
||||||
|
self.assertFalse(arch._validate_options())
|
||||||
|
|
||||||
|
arch.all_options['wrapper'] = 'savestate'
|
||||||
|
self.assertFalse(arch._validate_options())
|
||||||
|
|
||||||
|
arch.all_options['wrapper_archiver'] = 'rar'
|
||||||
|
self.assertTrue(arch._validate_options())
|
||||||
|
|||||||
Reference in New Issue
Block a user