Skip to content

Commit

Permalink
use '--appdir' argument when generating a recipe
Browse files Browse the repository at this point in the history
(if used)
  • Loading branch information
cabiste-dev authored and azubieta committed Feb 8, 2024
1 parent 80437be commit 68bbc14
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion appimagebuilder/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def __main__():
exit(0)

if args.generate:
generator = CommandGenerate()
generator = CommandGenerate(args.appdir)
generator.generate()
exit(0)

Expand Down
9 changes: 6 additions & 3 deletions appimagebuilder/modules/generate/command_generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ class GenerateMethodError(RuntimeError):


class CommandGenerate:
def __init__(self):
def __init__(self, app_dir):
self.logger = logging.getLogger("Generator")

self.logger.info("Searching AppDir")
self.app_dir = self._locate_app_dir()
self.app_dir = self._locate_app_dir(app_dir)

# configure Recipe Generator
package_manager_section_generators = []
Expand Down Expand Up @@ -88,7 +88,10 @@ def _write_recipe_file(self, recipe):
yaml.dump(recipe, f)

@staticmethod
def _locate_app_dir():
def _locate_app_dir(given_appdir):
if os.path.isdir(given_appdir):
return pathlib.Path(given_appdir).absolute()

for file_name in os.listdir(os.path.curdir):
if os.path.isdir(file_name) and file_name.lower() == "appdir":
return pathlib.Path(file_name).absolute()
Expand Down

0 comments on commit 68bbc14

Please sign in to comment.