forked from HowardHinnant/date
Fix iOS build
This commit is contained in:
@@ -86,6 +86,10 @@
|
|||||||
#include "date/tz_private.h"
|
#include "date/tz_private.h"
|
||||||
#include "date/ios.h"
|
#include "date/ios.h"
|
||||||
|
|
||||||
|
#ifndef __APPLE__
|
||||||
|
# define TARGET_OS_IPHONE 0
|
||||||
|
#endif
|
||||||
|
|
||||||
#if USE_OS_TZDB
|
#if USE_OS_TZDB
|
||||||
# include <dirent.h>
|
# include <dirent.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -333,6 +337,9 @@ discover_tz_dir()
|
|||||||
else
|
else
|
||||||
throw runtime_error("discover_tz_dir failed to find zoneinfo\n");
|
throw runtime_error("discover_tz_dir failed to find zoneinfo\n");
|
||||||
# else // __APPLE__
|
# else // __APPLE__
|
||||||
|
# if TARGET_OS_IPHONE
|
||||||
|
return "/var/db/timezone/zoneinfo";
|
||||||
|
# else
|
||||||
CONSTDATA auto timezone = "/etc/localtime";
|
CONSTDATA auto timezone = "/etc/localtime";
|
||||||
if (!(lstat(timezone, &sb) == 0 && S_ISLNK(sb.st_mode) && sb.st_size > 0))
|
if (!(lstat(timezone, &sb) == 0 && S_ISLNK(sb.st_mode) && sb.st_size > 0))
|
||||||
throw runtime_error("discover_tz_dir failed\n");
|
throw runtime_error("discover_tz_dir failed\n");
|
||||||
@@ -349,6 +356,7 @@ discover_tz_dir()
|
|||||||
if (i == string::npos)
|
if (i == string::npos)
|
||||||
throw runtime_error("discover_tz_dir failed to find '/'\n");
|
throw runtime_error("discover_tz_dir failed to find '/'\n");
|
||||||
return result.substr(0, i);
|
return result.substr(0, i);
|
||||||
|
# endif
|
||||||
# endif // __APPLE__
|
# endif // __APPLE__
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user