mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-31 09:04:14 +00:00
fix FS::HashedStorage::Init exceptions in ios simulator.
This commit is contained in:
parent
66d0b7aec4
commit
51446f0324
@ -9,6 +9,11 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
|
|
||||||
|
#if defined(MAC_OSX)
|
||||||
|
#include <boost/system/system_error.hpp>
|
||||||
|
#include <TargetConditionals.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <shlobj.h>
|
#include <shlobj.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
@ -251,8 +256,22 @@ namespace fs {
|
|||||||
auto p = root + i2p::fs::dirSep + prefix1 + chars[i];
|
auto p = root + i2p::fs::dirSep + prefix1 + chars[i];
|
||||||
if (boost::filesystem::exists(p))
|
if (boost::filesystem::exists(p))
|
||||||
continue;
|
continue;
|
||||||
if (boost::filesystem::create_directory(p))
|
#ifdef TARGET_OS_SIMULATOR
|
||||||
|
// ios simulator fs says it is case sensitive, but it is not
|
||||||
|
boost::system::error_code ec;
|
||||||
|
if (boost::filesystem::create_directory(p, ec))
|
||||||
|
continue;
|
||||||
|
switch (ec.value()) {
|
||||||
|
case boost::system::errc::file_exists:
|
||||||
|
case boost::system::errc::success:
|
||||||
|
continue;
|
||||||
|
default:
|
||||||
|
throw boost::system::system_error( ec, __func__ );
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
if (boost::filesystem::create_directory(p))
|
||||||
continue; /* ^ throws exception on failure */
|
continue; /* ^ throws exception on failure */
|
||||||
|
#endif
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user