Skip to content

Commit 0efd570

Browse files
committed
FFF fix FOMOD fileDependency evaluation
Wasn't taking ghosts into account and, more importantly, was passing strings to the LO API, which expects paths. As a result, every file was either missing or inactive. Also went ahead and swapped all usages of bolt.Path for bolt.GPath.
1 parent eb87ef6 commit 0efd570

1 file changed

Lines changed: 14 additions & 9 deletions

File tree

Mopy/bash/fomod.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@
4545
from distutils.version import LooseVersion
4646
from xml.etree import ElementTree as etree
4747

48-
from .bolt import Path
48+
from . import bush
49+
from .bolt import GPath
4950
from .load_order import cached_is_active
5051

5152
__author__ = "Ganda"
@@ -194,7 +195,7 @@ def process_files(cls, files_elem, file_list):
194195
source = file_object.get("source")
195196
if source.endswith(("/", "\\")):
196197
source = source[:-1]
197-
source = Path(source)
198+
source = GPath(source)
198199
destination = file_object.get("destination", None)
199200
if destination is None: # omitted destination
200201
destination = source
@@ -204,10 +205,10 @@ def process_files(cls, files_elem, file_list):
204205
# if empty or with a trailing slash then dest refers
205206
# to a folder. Post-processing to add the filename to the
206207
# end of the path.
207-
destination = Path(destination).join(Path(source).tail)
208+
destination = GPath(destination).join(GPath(source).tail)
208209
else:
209210
# destination still needs normalizing
210-
destination = Path(destination)
211+
destination = GPath(destination)
211212
priority = int(file_object.get("priority", "0"))
212213
for fname in file_list:
213214
if fname.lower() == source.s.lower(): # it's a file
@@ -217,7 +218,7 @@ def process_files(cls, files_elem, file_list):
217218
fdest = destination.s + fname[source_len:]
218219
if fdest.startswith(os.sep):
219220
fdest = fdest[1:]
220-
result.append(cls(Path(fname), Path(fdest), priority))
221+
result.append(cls(GPath(fname), GPath(fdest), priority))
221222
return result
222223

223224

@@ -363,13 +364,17 @@ def _flags(self):
363364
return flag_dict
364365

365366
def _test_file_condition(self, condition):
366-
file_name = condition.get("file")
367+
file_name = GPath(condition.get("file"))
367368
file_type = condition.get("state")
368-
file_path = self.dst_dir.join(file_name)
369-
if not file_path.exists(): # TODO: ghosts?
369+
# Check if it's missing, ghosted or (in)active
370+
if not self.dst_dir.join(file_name).exists():
370371
actual_type = "Missing"
372+
elif (file_name.cext in bush.game.espm_extensions and
373+
self.dst_dir.join(file_name + u'.ghost').exists()):
374+
actual_type = 'Inactive'
371375
else:
372-
actual_type = "Active" if cached_is_active(file_name) else "Inactive"
376+
actual_type = ("Active" if cached_is_active(file_name)
377+
else "Inactive")
373378
if actual_type != file_type:
374379
raise FailedCondition(
375380
"File {} should be {} but is {} instead.".format(

0 commit comments

Comments
 (0)