Skip to content

Commit

Permalink
If no version is compatible, mod installation now halts.
Browse files Browse the repository at this point in the history
If you explicitly have selected an incompatible version, it still lets you.

Should fix #42
  • Loading branch information
williambl committed Aug 11, 2017
1 parent aa4426b commit 2314b19
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CMAN_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ def install_mod(modname, version = None):
mod_data = get_mod_from_name(modname)

if (version == None):
if (not is_any_version_compatible(mod_data)):
cprint('No version of the mod is compatible!')
return
version = get_latest_compatible_version(mod_data)

version_number = 0
Expand Down
10 changes: 8 additions & 2 deletions CMAN_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,13 @@ def get_latest_compatible_version(mod):
for mod_version in mod.versions:
if (mc_version in mod_version['MCVersion']):
return mod_version['Version']


def is_any_version_compatible(mod):
for mod_version in mod.versions:
if (mc_version in mod_version['MCVersion']):
return True
return False

def cinput(terminal_text, gui_text=None, input_type='text', title="CMAN"):
print(terminal_text, gui_text, input_type, title)
if gui_text == None:
Expand All @@ -535,4 +541,4 @@ def cinput(terminal_text, gui_text=None, input_type='text', title="CMAN"):
elif (input_type == 'boolean'):
return dialogs.askyesno(parent=tkinst, prompt=gui_text, title=title)

return input(terminal_text)
return input(terminal_text)

0 comments on commit 2314b19

Please sign in to comment.