Skip to content

Commit

Permalink
Add support for modpak files
Browse files Browse the repository at this point in the history
Also fixed a bug in error report log output.

This is pretty basic but should be fine for now.
  • Loading branch information
wizzomafizzo committed Apr 7, 2014
1 parent 15fc74f commit a4598fd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion starcheat/assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,15 @@ def find_assets(self):
if os.path.isdir(mod_folder):
mod_assets = self.scan_asset_folder(mod_folder)
[index.append(x) for x in mod_assets]
elif mod_folder.endswith(".modpak"):
mod_assets = self.scan_modpak(mod_folder)
[index.append(x) for x in mod_assets]
return index

def scan_modpak(self, modpak):
# TODO: may need support for reading the mod folder from the pakinfo file
db = starbound.open_file(modpak)
index = [(x, modpak) for x in db.get_index()]
return index

def scan_asset_folder(self, folder):
Expand All @@ -151,13 +159,13 @@ def scan_asset_folder(self, folder):
return index
else:
# old style, probably a mod
# TODO: do packed mods still use the path key?
index = []
mod_assets = None
files = os.listdir(folder)

logging.debug(files)

# TODO: would like to keep this idea but moved to modpak specific function
found_mod_info = False #will need more logic to handle .modpack with modinfo inside.

for f in files:
Expand Down
2 changes: 1 addition & 1 deletion starcheat/starcheat.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def exception_handler(type, value, tb):
if starbound_folder is None:
logging.debug("No Starbound folder is set!")
else:
logging.debug("Starbound folder: %s", )
logging.debug("Starbound folder: %s", starbound_folder)
logging.debug("Assets folder: %s", config.Config().read("assets_folder"))
logging.debug("Player folder: %s", config.Config().read("player_folder"))

Expand Down

0 comments on commit a4598fd

Please sign in to comment.