Skip to content

Commit 2b9173b

Browse files
authored
Explicit convert from std::filesystem::path to std::string for Windows compatibility (#3249)
1 parent 415a4a2 commit 2b9173b

File tree

10 files changed

+22
-22
lines changed

10 files changed

+22
-22
lines changed

moveit_setup_assistant/moveit_setup_assistant/src/collisions_updater.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ int main(int argc, char* argv[])
100100
auto package_settings = config_data->get<moveit_setup::PackageSettingsConfig>("package_settings");
101101
try
102102
{
103-
package_settings->loadExisting(config_pkg_path);
103+
package_settings->loadExisting(config_pkg_path.string());
104104
}
105105
catch (const std::runtime_error& e)
106106
{
@@ -113,7 +113,7 @@ int main(int argc, char* argv[])
113113
RCLCPP_ERROR_STREAM(node->get_logger(), "Please provide config package or URDF and SRDF path");
114114
return 1;
115115
}
116-
else if (rdf_loader::RDFLoader::isXacroFile(srdf_path) && output_path.empty())
116+
else if (rdf_loader::RDFLoader::isXacroFile(srdf_path.string()) && output_path.empty())
117117
{
118118
RCLCPP_ERROR_STREAM(node->get_logger(), "Please provide a different output file for SRDF xacro input file");
119119
return 1;

moveit_setup_assistant/moveit_setup_assistant/src/setup_assistant_widget.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ SetupAssistantWidget::SetupAssistantWidget(const rviz_common::ros_integration::R
7171

7272
// Setting the window icon
7373
auto icon_path = getSharePath("moveit_ros_visualization") / "icons/classes/MotionPlanning.png";
74-
setWindowIcon(QIcon(icon_path.c_str()));
74+
setWindowIcon(QIcon(icon_path.string().c_str()));
7575

7676
// Basic widget container -----------------------------------------
7777
QHBoxLayout* layout = new QHBoxLayout();

moveit_setup_assistant/moveit_setup_core_plugins/include/moveit_setup_core_plugins/configuration_files.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class ConfigurationFiles : public SetupStep
8080

8181
bool shouldGenerate(const GeneratedFilePtr& file) const
8282
{
83-
std::string rel_path = file->getRelativePath();
83+
std::string rel_path = file->getRelativePath().string();
8484
auto it = should_generate_.find(rel_path);
8585
if (it == should_generate_.end())
8686
{

moveit_setup_assistant/moveit_setup_core_plugins/src/configuration_files_widget.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ void ConfigurationFilesWidget::changeCheckedState(QListWidgetItem* item)
294294
}
295295

296296
// Enable/disable file
297-
setup_step_.setShouldGenerate(gen_file->getRelativePath(), generate);
297+
setup_step_.setShouldGenerate(gen_file->getRelativePath().string(), generate);
298298
}
299299

300300
// ******************************************************************************************
@@ -303,7 +303,7 @@ void ConfigurationFilesWidget::changeCheckedState(QListWidgetItem* item)
303303
void ConfigurationFilesWidget::focusGiven()
304304
{
305305
// Pass the package path from start screen to configuration files screen
306-
stack_path_->setPath(setup_step_.getPackagePath());
306+
stack_path_->setPath(setup_step_.getPackagePath().string());
307307

308308
setup_step_.loadFiles();
309309

@@ -352,7 +352,7 @@ void ConfigurationFilesWidget::showGenFiles()
352352
auto gen_file = gen_files[i];
353353

354354
// Create a formatted row
355-
QListWidgetItem* item = new QListWidgetItem(QString(gen_file->getRelativePath().c_str()), action_list_, 0);
355+
QListWidgetItem* item = new QListWidgetItem(QString(gen_file->getRelativePath().string().c_str()), action_list_, 0);
356356

357357
// Checkbox
358358
item->setCheckState(setup_step_.shouldGenerate(gen_file) ? Qt::Checked : Qt::Unchecked);
@@ -480,7 +480,7 @@ bool ConfigurationFilesWidget::generatePackage()
480480
// Error occurred
481481
QMessageBox::critical(this, "Error Generating File",
482482
QString("Failed to generate folder or file: '")
483-
.append(gen_file->getRelativePath().c_str())
483+
.append(gen_file->getRelativePath().string().c_str())
484484
.append("' at location:\n")
485485
.append(absolute_path.c_str()));
486486
return false;

moveit_setup_assistant/moveit_setup_core_plugins/src/start_screen.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ std::filesystem::path StartScreen::getPackagePath()
7070

7171
void StartScreen::loadExisting(const std::filesystem::path& package_path)
7272
{
73-
package_settings_->loadExisting(package_path);
73+
package_settings_->loadExisting(package_path.string());
7474
}
7575

7676
bool StartScreen::isXacroFile()

moveit_setup_assistant/moveit_setup_core_plugins/src/start_screen_widget.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,15 +205,15 @@ void StartScreenWidget::focusGiven()
205205
std::filesystem::path pkg_path = setup_step_.getPackagePath();
206206
if (!pkg_path.empty())
207207
{
208-
stack_path_->setPath(pkg_path);
208+
stack_path_->setPath(pkg_path.string());
209209
select_mode_->btn_exist_->click();
210210
return;
211211
}
212212

213213
std::filesystem::path urdf_path = setup_step_.getURDFPath();
214214
if (!urdf_path.empty())
215215
{
216-
urdf_file_->setPath(urdf_path);
216+
urdf_file_->setPath(urdf_path.string());
217217
select_mode_->btn_new_->click();
218218
}
219219
}
@@ -324,7 +324,7 @@ bool StartScreenWidget::loadPackageSettings(bool show_warnings)
324324

325325
try
326326
{
327-
setup_step_.loadExisting(package_path_input);
327+
setup_step_.loadExisting(package_path_input.string());
328328
return true;
329329
}
330330
catch (const std::runtime_error& e)

moveit_setup_assistant/moveit_setup_framework/include/moveit_setup_framework/data/srdf_config.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ class SRDFConfig : public SetupConfig
263263

264264
bool write(const std::filesystem::path& path)
265265
{
266-
return srdf_.writeSRDF(path);
266+
return srdf_.writeSRDF(path.string());
267267
}
268268

269269
std::filesystem::path getPath() const

moveit_setup_assistant/moveit_setup_framework/src/srdf_config.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ void SRDFConfig::loadSRDFFile(const std::filesystem::path& srdf_file_path, const
8888
loadURDFModel();
8989

9090
std::string srdf_string;
91-
if (!rdf_loader::RDFLoader::loadXmlFileToString(srdf_string, srdf_path_, xacro_args))
91+
if (!rdf_loader::RDFLoader::loadXmlFileToString(srdf_string, srdf_path_.string(), xacro_args))
9292
{
9393
throw std::runtime_error("SRDF file not found: " + srdf_path_.string());
9494
}

moveit_setup_assistant/moveit_setup_framework/src/urdf_config.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,13 @@ void URDFConfig::setPackageName()
120120
void URDFConfig::loadFromPackage(const std::filesystem::path& package_name, const std::filesystem::path& relative_path,
121121
const std::string& xacro_args)
122122
{
123-
const std::filesystem::path package_path = getSharePath(package_name);
123+
const std::filesystem::path package_path = getSharePath(package_name.string());
124124
if (package_path.empty())
125125
{
126126
throw std::runtime_error("URDF/COLLADA package not found: ''" + package_name.string());
127127
}
128128

129-
urdf_pkg_name_ = package_name;
129+
urdf_pkg_name_ = package_name.string();
130130
urdf_pkg_relative_path_ = relative_path;
131131
xacro_args_ = xacro_args;
132132

@@ -139,12 +139,12 @@ void URDFConfig::load()
139139
RCLCPP_DEBUG_STREAM(*logger_, "URDF Package Name: " << urdf_pkg_name_);
140140
RCLCPP_DEBUG_STREAM(*logger_, "URDF Package Path: " << urdf_pkg_relative_path_);
141141

142-
if (!rdf_loader::RDFLoader::loadXmlFileToString(urdf_string_, urdf_path_, xacro_args_vec_))
142+
if (!rdf_loader::RDFLoader::loadXmlFileToString(urdf_string_, urdf_path_.string(), xacro_args_vec_))
143143
{
144144
throw std::runtime_error("URDF/COLLADA file not found: " + urdf_path_.string());
145145
}
146146

147-
if (urdf_string_.empty() && rdf_loader::RDFLoader::isXacroFile(urdf_path_))
147+
if (urdf_string_.empty() && rdf_loader::RDFLoader::isXacroFile(urdf_path_.string()))
148148
{
149149
throw std::runtime_error("Running xacro failed.\nPlease check console for errors.");
150150
}
@@ -154,7 +154,7 @@ void URDFConfig::load()
154154
{
155155
throw std::runtime_error("URDF/COLLADA file is not a valid robot model.");
156156
}
157-
urdf_from_xacro_ = rdf_loader::RDFLoader::isXacroFile(urdf_path_);
157+
urdf_from_xacro_ = rdf_loader::RDFLoader::isXacroFile(urdf_path_.string());
158158

159159
// Set parameter
160160
parent_node_->set_parameter(rclcpp::Parameter("robot_description", urdf_string_));
@@ -164,7 +164,7 @@ void URDFConfig::load()
164164

165165
bool URDFConfig::isXacroFile() const
166166
{
167-
return rdf_loader::RDFLoader::isXacroFile(urdf_path_);
167+
return rdf_loader::RDFLoader::isXacroFile(urdf_path_.string());
168168
}
169169

170170
bool URDFConfig::isConfigured() const
@@ -182,7 +182,7 @@ void URDFConfig::collectVariables(std::vector<TemplateVariable>& variables)
182182
std::string urdf_location;
183183
if (urdf_pkg_name_.empty())
184184
{
185-
urdf_location = urdf_path_;
185+
urdf_location = urdf_path_.string();
186186
}
187187
else
188188
{

moveit_setup_assistant/moveit_setup_framework/src/utilities.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ bool extractPackageNameFromPath(const std::filesystem::path& path, std::string&
6363
// Default package name to folder name
6464
package_name = sub_path.filename().string();
6565
tinyxml2::XMLDocument package_xml_file;
66-
auto is_open = package_xml_file.LoadFile((sub_path / "package.xml").c_str());
66+
auto is_open = package_xml_file.LoadFile((sub_path / "package.xml").string().c_str());
6767
if (is_open == tinyxml2::XML_SUCCESS)
6868
{
6969
auto name_potential =

0 commit comments

Comments
 (0)