ros-industrial / ros_qtc_plugin

ROS Qt Creator Plug-in (https://ros-qtc-plugin.readthedocs.io)
401 stars 215 forks source link

source for zsh support #392

Open SdKay opened 5 years ago

SdKay commented 5 years ago

Hi, I have seen that there was a commit for supporting zsh, but I use the recent version build project and get the messages below:

[ROS Warning] Unable to locate build directory for package: demo_pub. [ROS Warning] Unable to locate package rviz_tele_ctrl build file: /home/sdk/workspace/ros/demo_ws/build/rviz_tele_ctrl/rviz_tele_ctrl.cbp. [ROS Debug] Sourced workspace: /home/sdk/workspace/ros/demo_ws/devel/setup.bash.

I see the source code, in ros_qtc_plugin-4.9/src/project_manager/ros_utils.cpp, it seems that default shell is still bash

bool ROSUtils::sourceROS(QProcess *process, const Utils::FileName &rosDistribution)
{
  bool results = sourceWorkspaceHelper(process, Utils::FileName(rosDistribution).appendPath(QLatin1String("setup.bash")).toString());
  if (!results)
    Core::MessageManager::write(QObject::tr("[ROS Warning] Faild to source ROS Distribution: %1.").arg(rosDistribution.toString()));

  return results;
}

bool ROSUtils::sourceWorkspace(QProcess *process, const WorkspaceInfo &workspaceInfo)
{
    if (!initializeWorkspace(process, workspaceInfo))
        return false;

    Utils::FileName bash(workspaceInfo.develPath);
    if (workspaceInfo.install)
      bash = Utils::FileName(workspaceInfo.installPath);

    bash.appendPath(QLatin1String("setup.bash"));
    if (bash.exists())
    {
        Core::MessageManager::write(QObject::tr("[ROS Debug] Sourced workspace: %1.").arg(bash.toString()));
        if (sourceWorkspaceHelper(process, bash.toString()))
            return true;
    }
    else
    {
        Core::MessageManager::write(QObject::tr("[ROS Warning] Failed to source workspace because this file does not exist: %1.").arg(bash.toString()));
        return true;
    }

    Core::MessageManager::write(QObject::tr("[ROS Warning] Failed to source workspace: %1.").arg(workspaceInfo.path.toString()));
    return false;
}

Is there any problem in plugin or my configuration. Thanks a lot!

Levi-Armstrong commented 5 years ago

When building it uses bash but for the integrated terminal when running ros nodes or launch files it reads the environment to source the correct file. See ros_generic_run_step.cpp.