Skip to content

Commit

Permalink
[PlatformIO] Add custom project dir option
Browse files Browse the repository at this point in the history
  • Loading branch information
vzahradnik authored and PetteriAimonen committed Nov 30, 2024
1 parent 1e77a68 commit ccbf395
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion generator/platformio_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 32,13 @@

nanopb_root = os.path.join(os.getcwd(), '..')

project_dir = env.subst("$PROJECT_DIR")
# Check if 'custom_nanopb_project_dir' is defined, else default to $PROJECT_DIR
project_dir = env.GetProjectOption("custom_nanopb_project_dir", default=None)
if project_dir:
project_dir = env.subst(project_dir)
else:
project_dir = env.subst("$PROJECT_DIR")

build_dir = env.subst("$BUILD_DIR")

generated_src_dir = os.path.join(build_dir, 'nanopb', 'generated-src')
Expand All @@ -53,6 59,7 @@
protos_files = fs.match_src_files(project_dir, nanopb_protos)
if not len(protos_files):
print("[nanopb] ERROR: No files matched pattern:")
print(f"project_directory: {project_dir}")
print(f"custom_nanopb_protos: {nanopb_protos}")
exit(1)

Expand Down

0 comments on commit ccbf395

Please sign in to comment.