private void InitializeLogging() { // get the data from the intent, which is a Uri AndroidJavaObject logFileUri = _intent.Call <AndroidJavaObject>("getData"); if (logFileUri == null) { return; } string encodedPath = logFileUri.Call <string>("getEncodedPath"); Debug.Log("[FTL] Log file is located at: " + encodedPath); try { int fd = _activity .Call <AndroidJavaObject>("getContentResolver") .Call <AndroidJavaObject>("openAssetFileDescriptor", logFileUri, "w") .Call <AndroidJavaObject>("getParcelFileDescriptor") .Call <int>("getFd"); Debug.Log("[FTL] extracted file descriptor from intent: " + fd); _logFileDescriptor = LibcWrapper.dup(fd); Debug.Log("[FTL] duplicated file descriptor: " + _logFileDescriptor); Debug.Log("[FTL] trying to write to fd: " + _logFileDescriptor); } catch (Exception e) { Debug.LogError("[FTL] - exception fetching log file descriptor: " + e + "\n" + e.StackTrace); } }
public override void LogToResults(string s) { LibcWrapper.WriteToFileDescriptor(_logFileDescriptor, s); }