Skip to content

Commit

Permalink
Eliminates std::filesystem usage in utils.cc (#1346)
Browse files Browse the repository at this point in the history
Depends on gazebosim/gz-common#312

See gazebo-tooling/release-tools#639

Basically, this removes the dependency on `std::filesystem` in  ign-gazebo as its been causing issues when binaries are produced by diffrent compiler versions. This current version makes sure that we keep all `std::filesystem` code in` ign-common`.

Signed-off-by: Arjo Chakravarty <arjo@openrobotics.org>

Co-authored-by: Louise Poubel <louise@openrobotics.org>
  • Loading branch information
arjo129 and chapulina authored Mar 2, 2022
1 parent c58a968 commit 4c84e1c
Showing 1 changed file with 1 addition and 28 deletions.
29 changes: 1 addition & 28 deletions src/Util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,6 @@
*
*/

#ifndef __APPLE__
#if (defined(_MSVC_LANG))
#if (_MSVC_LANG >= 201703L || __cplusplus >= 201703L)
#include <filesystem> // c++17
#else
#define _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING
#include <experimental/filesystem>
#endif
#elif __GNUC__ < 8
#include <experimental/filesystem>
#else
#include <filesystem>
#endif
#endif

#include <ignition/common/Filesystem.hh>
#include <ignition/common/StringUtils.hh>
#include <ignition/common/Util.hh>
Expand Down Expand Up @@ -349,20 +334,8 @@ std::string asFullPath(const std::string &_uri, const std::string &_filePath)
return _uri;
}
#else
// Not a relative path, return unmodified
#if (defined(_MSVC_LANG))
#if (_MSVC_LANG >= 201703L || __cplusplus >= 201703L)
using namespace std::filesystem;
#else
using namespace std::experimental::filesystem;
#endif
#elif __GNUC__ < 8
using namespace std::experimental::filesystem;
#else
using namespace std::filesystem;
#endif
if (_uri.find("://") != std::string::npos ||
!path(_uri).is_relative())
!common::isRelativePath(_uri))
{
return _uri;
}
Expand Down

0 comments on commit 4c84e1c

Please sign in to comment.