mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-06 21:58:57 -04:00
Fix compilation with C++17
This commit is contained in:
parent
282f4f18a3
commit
8bed99cc9f
1 changed files with 22 additions and 20 deletions
|
@ -4,8 +4,8 @@
|
||||||
* libretroshare: retroshare core library *
|
* libretroshare: retroshare core library *
|
||||||
* *
|
* *
|
||||||
* Copyright (C) 2004-2007 Robert Fernie <retroshare@lunamutt.com> *
|
* Copyright (C) 2004-2007 Robert Fernie <retroshare@lunamutt.com> *
|
||||||
* Copyright (C) 2020 Gioacchino Mazzurco <gio@eigenlab.org> *
|
* Copyright (C) 2020-2021 Gioacchino Mazzurco <gio@eigenlab.org> *
|
||||||
* Copyright (C) 2020 Asociación Civil Altermundi <info@altermundi.net> *
|
* Copyright (C) 2020-2021 Asociación Civil Altermundi <info@altermundi.net> *
|
||||||
* *
|
* *
|
||||||
* This program is free software: you can redistribute it and/or modify *
|
* This program is free software: you can redistribute it and/or modify *
|
||||||
* it under the terms of the GNU Lesser General Public License as *
|
* it under the terms of the GNU Lesser General Public License as *
|
||||||
|
@ -64,6 +64,26 @@
|
||||||
* #define RSDIR_DEBUG 1
|
* #define RSDIR_DEBUG 1
|
||||||
****/
|
****/
|
||||||
|
|
||||||
|
#if __cplusplus < 201703L
|
||||||
|
bool std::filesystem::create_directories(const std::string& path)
|
||||||
|
{
|
||||||
|
for( std::string::size_type lastIndex = 0; lastIndex < std::string::npos;
|
||||||
|
lastIndex = path.find('/', lastIndex) )
|
||||||
|
{
|
||||||
|
std::string&& curDir = path.substr(0, ++lastIndex);
|
||||||
|
if(!RsDirUtil::checkCreateDirectory(curDir))
|
||||||
|
{
|
||||||
|
RsErr() << __PRETTY_FUNCTION__ << " failure creating: " << curDir
|
||||||
|
<< " of: " << path << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
# include <filesystem>
|
||||||
|
#endif // __cplusplus < 201703L
|
||||||
|
|
||||||
std::string RsDirUtil::getTopDir(const std::string& dir)
|
std::string RsDirUtil::getTopDir(const std::string& dir)
|
||||||
{
|
{
|
||||||
std::string top;
|
std::string top;
|
||||||
|
@ -528,24 +548,6 @@ bool RsDirUtil::checkCreateDirectory(const std::string& dir)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if __cplusplus < 201703L
|
|
||||||
bool std::filesystem::create_directories(const std::string& path)
|
|
||||||
{
|
|
||||||
for( std::string::size_type lastIndex = 0; lastIndex < std::string::npos;
|
|
||||||
lastIndex = path.find('/', lastIndex) )
|
|
||||||
{
|
|
||||||
std::string&& curDir = path.substr(0, ++lastIndex);
|
|
||||||
if(!RsDirUtil::checkCreateDirectory(curDir))
|
|
||||||
{
|
|
||||||
RsErr() << __PRETTY_FUNCTION__ << " failure creating: " << curDir
|
|
||||||
<< " of: " << path << std::endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
#endif // __cplusplus < 201703L
|
|
||||||
|
|
||||||
std::string RsDirUtil::removeSymLinks(const std::string& path)
|
std::string RsDirUtil::removeSymLinks(const std::string& path)
|
||||||
{
|
{
|
||||||
#if defined(WINDOWS_SYS) || defined(__APPLE__) || defined(__ANDROID__)
|
#if defined(WINDOWS_SYS) || defined(__APPLE__) || defined(__ANDROID__)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue