Browse Source

Handle filepaths better

This change lops off any filename portion of a path and attempts to
verify that it is a valid Uru directory.
pull/92/head
Adam Johnson 6 years ago
parent
commit
b5cf75afd1
Signed by: Hoikas
GPG Key ID: 0B6515D6FF6F271E
  1. 7
      korman/operators/op_world.py

7
korman/operators/op_world.py

@ -36,9 +36,10 @@ class GameAddOperator(AgeOperator, bpy.types.Operator):
if w:
# First, verify this is a valid Uru directory...
path = Path(self.filepath)
# Blendsucks likes to tack filenames onto our doggone directories...
if not path.is_dir():
self.report({"ERROR"}, "The selection is not a valid directory.")
return {"CANCELLED"}
path = path.parent
if not ((path / "UruExplorer.exe").is_file() or (path / "plClient.exe").is_file()):
self.report({"ERROR"}, "The selected directory is not a copy of URU.")
return {"CANCELLED"}
@ -53,7 +54,7 @@ class GameAddOperator(AgeOperator, bpy.types.Operator):
game = games.games[self.game_index]
# Setup game...
game.path = self.filepath
game.path = str(path)
if (path / "cypython22.dll").is_file():
game.version = "pvPots"
else:

Loading…
Cancel
Save