1
0
mirror of https://github.com/gryf/fs-uae-wrapper.git synced 2025-12-29 09:52:29 +01:00

Fixed deduction of archive name.

When in different directory, the archive name and config need to be
treated differently. This commit unify behavior for both cases.

Also, changing a bit logging format and added some more debugging
messages.
This commit is contained in:
2024-09-12 20:29:32 +02:00
parent 148d28dac2
commit 463f6ed705
2 changed files with 8 additions and 3 deletions

View File

@@ -42,6 +42,7 @@ class Base(object):
- run the emulation - run the emulation
- archive save state - archive save state
""" """
logging.debug("run")
if not self._validate_options(): if not self._validate_options():
return False return False
@@ -217,6 +218,7 @@ class Base(object):
if val.startswith('$CONFIG'): if val.startswith('$CONFIG'):
abspath = utils.interpolate_variables(val, self.conf_file) abspath = utils.interpolate_variables(val, self.conf_file)
changed_options[key] = abspath changed_options[key] = abspath
logging.info("%s: %s => %s", key, val, abspath)
continue continue
_val = os.path.abspath(val) _val = os.path.abspath(val)
@@ -282,6 +284,7 @@ class ArchiveBase(Base):
def _extract(self): def _extract(self):
"""Extract archive to temp dir""" """Extract archive to temp dir"""
logging.debug("_extract")
title = self._get_title() title = self._get_title()
curdir = os.path.abspath('.') curdir = os.path.abspath('.')
@@ -291,6 +294,7 @@ class ArchiveBase(Base):
return result return result
def _validate_options(self): def _validate_options(self):
logging.debug("_validate_options")
validation_result = super(ArchiveBase, self)._validate_options() validation_result = super(ArchiveBase, self)._validate_options()
@@ -312,8 +316,8 @@ class ArchiveBase(Base):
Return full path to the archive name using configuration file Return full path to the archive name using configuration file
basename and appending one of the expected archive extensions. basename and appending one of the expected archive extensions.
""" """
basename = os.path.splitext(self.conf_file)[0] basename = os.path.splitext(os.path.basename(self.conf_file))[0]
file_list = os.listdir('.') file_list = os.listdir(os.path.dirname(self.conf_file))
for fname in file_list: for fname in file_list:
for ext in ('.7z', '.lha', '.lzx', '.zip', '.rar', '.tar', '.tgz', for ext in ('.7z', '.lha', '.lzx', '.zip', '.rar', '.tar', '.tgz',
'.tar.gz', '.tar.bz2', '.tar.xz'): '.tar.gz', '.tar.bz2', '.tar.xz'):

View File

@@ -27,7 +27,8 @@ def setup_logger(options):
level = logging.DEBUG level = logging.DEBUG
logging.basicConfig(level=level, logging.basicConfig(level=level,
format="%(asctime)s %(levelname)s: %(message)s") format="%(asctime)s %(levelname)s\t%(filename)s:"
"%(lineno)d:\t\t%(message)s")
def parse_args(): def parse_args():