Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/fishros/install
Browse files Browse the repository at this point in the history
  • Loading branch information
fishros committed Sep 8, 2024
2 parents e9736c0 + 72f9bdf commit c268477
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions tools/tool_config_rosenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,16 @@ def get_source_command(dic):
shell_file = ".{}rc".format(shell)
for userhome in usershomes:
shell_path = os.path.join(userhome,shell_file)
PrintUtils.print_delay('正在准备配置用户目录:{}'.format(userhome))
PrintUtils.print_delay('正在准备配置用户目录:{}'.format(shell_path))
if FileUtils.exists(shell_path):
PrintUtils.print_info('当前系统包含{}个ROS,已为您完成启动终端自动激活ROS环境,修改{}可关闭'.format(ros_count,shell_path))
if ros_count>1:
PrintUtils.print_info('当前系统包含{}个ROS,已为您完成启动终端自动激活ROS环境,修改{}可关闭'.format(ros_count,shell_path))
if ros_count>1:
data = get_source_command(ros_sourcefile)
else:
data = 'source {}'.format(ros_sourcefile[0])
FileUtils.find_replace(shell_path,"source\s+/opt/ros/[A-Za-z]+/setup.{}".format(shell),"") # 删除旧source
FileUtils.find_replace_sub(shell_path,"# >>> fishros initialize >>>","# <<< fishros initialize <<<", "") # 替换
FileUtils.append(shell_path,"# >>> fishros initialize >>>\n"+data+"\n# <<< fishros initialize <<<\n") # 添加
data = get_source_command(ros_sourcefile)
else:
data = 'source {}'.format(ros_sourcefile[0])
FileUtils.find_replace(shell_path,"source\s+/opt/ros/[A-Za-z]+/setup.{}".format(shell),"") # 删除旧source
FileUtils.find_replace_sub(shell_path,"# >>> fishros initialize >>>","# <<< fishros initialize <<<", "") # 替换
FileUtils.append(shell_path,"# >>> fishros initialize >>>\n"+data+"\n# <<< fishros initialize <<<\n") # 添加
PrintUtils.print_text("")

def run(self):
Expand Down

0 comments on commit c268477

Please sign in to comment.