libjingle_unittest now compiles and passes on iOS!
Example run from cmd-line:
ninja -C out_ios/Debug-iphoneos libjingle_unittest && ~/src/ios-deploy/ios-deploy -d -u -v -b ~/src/wr/trunk/out_ios/Debug-iphoneos/libjingle_unittest.app
Note that the test's use of signals means that lldb will break in the middle of the suite. To ignore these signals tell lldb:
pro hand -p true -s false -n false SIGINT
pro hand -p true -s false -n false SIGTERM
continue
BUG=3241
R=noahric@google.com, tkchin@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/12229004
git-svn-id: http://webrtc.googlecode.com/svn/trunk@5986 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/talk/base/unixfilesystem.cc b/talk/base/unixfilesystem.cc
index c987691..8ac7499 100644
--- a/talk/base/unixfilesystem.cc
+++ b/talk/base/unixfilesystem.cc
@@ -66,6 +66,15 @@
#include "talk/base/stream.h"
#include "talk/base/stringutils.h"
+#if defined(IOS)
+// Defined in iosfilesystem.mm. No header file to discourage use
+// elsewhere; other places should use GetApp{Data,Temp}Folder() in
+// this file. Don't copy/paste. I mean it.
+char* IOSDataDirectory();
+char* IOSTempDirectory();
+void IOSAppName(talk_base::Pathname* path);
+#endif
+
namespace talk_base {
#if !defined(ANDROID) && !defined(IOS)
@@ -85,6 +94,17 @@
}
#endif
+UnixFilesystem::UnixFilesystem() {
+#if defined(IOS)
+ if (!provided_app_data_folder_)
+ provided_app_data_folder_ = IOSDataDirectory();
+ if (!provided_app_temp_folder_)
+ provided_app_temp_folder_ = IOSTempDirectory();
+#endif
+}
+
+UnixFilesystem::~UnixFilesystem() {}
+
bool UnixFilesystem::CreateFolder(const Pathname &path, mode_t mode) {
std::string pathname(path.pathname());
int len = pathname.length();
@@ -369,6 +389,9 @@
return success;
#elif defined(__native_client__)
return false;
+#elif IOS
+ IOSAppName(path);
+ return true;
#else // OSX
char buffer[PATH_MAX + 2];
ssize_t len = readlink("/proc/self/exe", buffer, ARRAY_SIZE(buffer) - 1);
@@ -521,7 +544,7 @@
#endif // ANDROID
#if defined(LINUX) || defined(ANDROID)
*freebytes = static_cast<int64>(vfs.f_bsize) * vfs.f_bavail;
-#elif defined(OSX)
+#elif defined(OSX) || defined(IOS)
*freebytes = static_cast<int64>(vfs.f_frsize) * vfs.f_bavail;
#endif