Skip to content

Commit

Permalink
make tuple conversation safe on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
dirk-thomas committed Nov 21, 2018
1 parent 7ec21f7 commit 873b97a
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions rosidl_cmake/cmake/rosidl_generate_interfaces.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ macro(rosidl_generate_interfaces target)
"file '${_file}' must be represented as an absolute base path "
"separated by a colon from the relative path to the interface file")
endif()
string(REPLACE ":" "/" _abs_file "${_file}")
string(REGEX REPLACE ":([^:]*)$" "/\\1" _abs_file "${_file}")
if(NOT EXISTS "${_abs_file}")
message(FATAL_ERROR "rosidl_generate_interfaces() the passed file "
"'${_abs_file}' doesn't exist")
Expand All @@ -96,7 +96,7 @@ macro(rosidl_generate_interfaces target)

# stamp all interface files
foreach(_tuple ${_interface_tuples})
string(REPLACE ":" "/" _abs_interface "${_tuple}")
string(REGEX REPLACE ":([^:]*)$" "/\\1" _abs_interface "${_tuple}")
stamp("${_abs_interface}")
endforeach()

Expand Down Expand Up @@ -149,14 +149,14 @@ macro(rosidl_generate_interfaces target)

set(_non_idl_files "")
foreach(_tuple ${_non_idl_tuples})
string(REPLACE ":" "/" _non_idl_file "${_tuple}")
string(REGEX REPLACE ":([^:]*)$" "/\\1" _non_idl_file "${_tuple}")
list(APPEND _non_idl_files "${_non_idl_file}")

# Split .srv into two .msg files
get_filename_component(_extension "${_tuple}" EXT)
# generate request and response messages for services
if(_extension STREQUAL ".srv")
string(REPLACE ":" ";" _list "${_tuple}")
string(REGEX REPLACE ":([^:]*)$" ";\\1" _list "${_tuple}")
list(GET _list 1 _relpath)
get_filename_component(_name "${_relpath}" NAME_WE)
get_filename_component(_parent_folder "${_relpath}" DIRECTORY)
Expand Down Expand Up @@ -233,7 +233,7 @@ macro(rosidl_generate_interfaces target)
# register interfaces with the ament index
set(_idl_files_lines)
foreach(_idl_tuple ${_idl_tuples})
string(REPLACE ":" ";" _idl_list "${_idl_tuple}")
string(REGEX REPLACE ":([^:]*)$" ";\\1" _idl_list "${_idl_tuple}")
list(GET _idl_list 1 _idl_relpath)
file(TO_CMAKE_PATH "${_idl_relpath}" _idl_relpath)
list(APPEND _idl_files_lines "${_idl_relpath}")
Expand Down Expand Up @@ -307,9 +307,9 @@ macro(rosidl_generate_interfaces target)

if(NOT _ARG_SKIP_INSTALL)
foreach(_idl_tuple ${_idl_tuples})
string(REPLACE ":" ";" _idl_list "${_idl_tuple}")
string(REGEX REPLACE ":([^:]*)$" ";\\1" _idl_list "${_idl_tuple}")
list(GET _idl_list 1 _idl_relpath)
string(REPLACE ":" "/" _idl_file "${_idl_tuple}")
string(REGEX REPLACE ":([^:]*)$" "/\\1" _idl_file "${_idl_tuple}")
get_filename_component(_parent_folders "${_idl_relpath}" DIRECTORY)
install(
FILES ${_idl_file}
Expand Down

0 comments on commit 873b97a

Please sign in to comment.