Add a pwad_path property and also convert the iwad_path method to a property.
This commit is contained in:
parent
5881c94c11
commit
b14c12c609
3 changed files with 12 additions and 7 deletions
|
@ -2,6 +2,7 @@ import dcc.config
|
|||
import tomlkit
|
||||
from tomlkit.toml_file import TOMLFile
|
||||
|
||||
|
||||
class Configure(dcc.config.Base):
|
||||
def get_parser(self, prog_name):
|
||||
parser = super().get_parser(prog_name)
|
||||
|
@ -11,7 +12,7 @@ class Configure(dcc.config.Base):
|
|||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
new_config = self.pwads.joinpath(parsed_args.wad).joinpath(self.config_name)
|
||||
new_config = self.pwad_path.joinpath(self.config_name)
|
||||
if new_config.exists():
|
||||
raise Exception("Config %s already exists.".format(new_config))
|
||||
|
||||
|
|
|
@ -29,9 +29,14 @@ class Wad(dcc.config.Base):
|
|||
def wad(self):
|
||||
return self._wad
|
||||
|
||||
@property
|
||||
def pwad_path(self):
|
||||
return self.pwads.joinpath(self.wad)
|
||||
|
||||
@property
|
||||
def iwad_path(self):
|
||||
iwad = self.iwads.joinpath(self._config.get("iwad"))
|
||||
iwadpath = self.pwads.joinpath(self.wad).joinpath("iwad")
|
||||
iwadpath = self.pwad_path.joinpath("iwad")
|
||||
if iwadpath.exists():
|
||||
with io.open(iwadpath) as f:
|
||||
iwad = self.iwads.joinpath(f.read().strip() + ".WAD")
|
||||
|
@ -61,14 +66,13 @@ class WadMap(Wad):
|
|||
return "" if self._name is None else "_" + self._name
|
||||
|
||||
def dsda_preamble(self):
|
||||
args = ["-iwad", self.iwad_path()]
|
||||
args = ["-iwad", self.iwad_path]
|
||||
|
||||
pwadpath = self.pwads.joinpath(self.wad)
|
||||
wads = sorted(pwadpath.glob('*.wad', case_sensitive=False))
|
||||
wads = sorted(self.pwad_path.glob('*.wad', case_sensitive=False))
|
||||
if len(wads) > 0:
|
||||
args = args + ["-file"] + wads
|
||||
|
||||
dehs = sorted(pwadpath.glob('*.deh', case_sensitive=False))
|
||||
dehs = sorted(self.pwad_path.glob('*.deh', case_sensitive=False))
|
||||
if len(dehs) > 0:
|
||||
args = args + ["-deh"] + dehs
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ class Eureka(dcc.doom_base.WadMap):
|
|||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
iwad = self.iwad_path()
|
||||
iwad = self.iwad_path
|
||||
pwadpath = self.pwads.joinpath(parsed_args.wad)
|
||||
if parsed_args.main is not None:
|
||||
mw = pwadpath.joinpath(parsed_args.main)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue