mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-11 15:39:36 -05:00
Fix compilation with C++17
This commit is contained in:
parent
282f4f18a3
commit
8bed99cc9f
@ -4,8 +4,8 @@
|
||||
* libretroshare: retroshare core library *
|
||||
* *
|
||||
* Copyright (C) 2004-2007 Robert Fernie <retroshare@lunamutt.com> *
|
||||
* Copyright (C) 2020 Gioacchino Mazzurco <gio@eigenlab.org> *
|
||||
* Copyright (C) 2020 Asociación Civil Altermundi <info@altermundi.net> *
|
||||
* Copyright (C) 2020-2021 Gioacchino Mazzurco <gio@eigenlab.org> *
|
||||
* Copyright (C) 2020-2021 Asociación Civil Altermundi <info@altermundi.net> *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License as *
|
||||
@ -64,6 +64,26 @@
|
||||
* #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 top;
|
||||
@ -528,24 +548,6 @@ bool RsDirUtil::checkCreateDirectory(const std::string& dir)
|
||||
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)
|
||||
{
|
||||
#if defined(WINDOWS_SYS) || defined(__APPLE__) || defined(__ANDROID__)
|
||||
|
Loading…
Reference in New Issue
Block a user