Skip to content

Commit

Permalink
Copy forests (#865)
Browse files Browse the repository at this point in the history
  • Loading branch information
andyblarblar authored Nov 20, 2023
1 parent b0361c0 commit b65c5ae
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions webots_ros2_driver/webots_ros2_driver/webots_launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,16 @@ def execute(self, context: LaunchContext):
sumonet_copy_path = Path(self.__world_copy.name).with_name(Path(self.__world_copy.name).stem + '_net')
shutil.copytree(sumonet_path, sumonet_copy_path)

# Copy forests
forests_path = Path(world_path).with_name('forest')
if forests_path.exists():
forests_copy = Path(self.__world_copy.name).with_name('forest')

if forests_copy.exists():
shutil.rmtree(forests_copy)

shutil.copytree(forests_path, forests_copy)

# Update relative paths in the world
with open(self.__world_copy.name, 'r') as file:
content = file.read()
Expand Down

0 comments on commit b65c5ae

Please sign in to comment.