Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Gabriele Buondonno
pinocchio
Commits
9ad8a3d8
Commit
9ad8a3d8
authored
Mar 03, 2016
by
Valenza Florian
Browse files
[CMake] Added missing file to git repo
parent
bec54309
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/tools/file-explorer.hpp
0 → 100644
View file @
9ad8a3d8
//
// Copyright (c) 2016 CNRS
//
// This file is part of Pinocchio
// Pinocchio is free software: you can redistribute it
// and/or modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation, either version
// 3 of the License, or (at your option) any later version.
//
// Pinocchio is distributed in the hope that it will be
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Lesser Public License for more details. You should have
// received a copy of the GNU Lesser General Public License along with
// Pinocchio If not, see
// <http://www.gnu.org/licenses/>.
#ifndef __se3_file_explorer_hpp__
#define __se3_file_explorer_hpp__
#include
<string>
#include
<iostream>
#include
<vector>
#include
"boost/filesystem.hpp"
namespace
se3
{
/**
* @brief Parse env variable ROS_PACKAGE_PATH to extract paths
*
* @return The different paths in ROS_PACKAGE_PATH
*/
inline
std
::
vector
<
std
::
string
>
getRosPackagePaths
()
{
std
::
vector
<
std
::
string
>
results
;
std
::
string
delimiter
=
":"
;
std
::
string
policyStr
=
std
::
getenv
(
"ROS_PACKAGE_PATH"
);
size_t
lastOffset
=
0
;
while
(
true
)
{
size_t
offset
=
policyStr
.
find_first_of
(
delimiter
,
lastOffset
);
if
(
offset
<
policyStr
.
size
())
results
.
push_back
(
policyStr
.
substr
(
lastOffset
,
offset
-
lastOffset
));
if
(
offset
==
std
::
string
::
npos
)
break
;
else
lastOffset
=
offset
+
1
;
// add one to skip the delimiter
}
return
results
;
}
}
#endif // __se3_file_explorer_hpp__
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment