protected static bool GetResourceContents(string path, IntPtr dst) { try { Logger.LogDebug($"{path} is requested"); var cachePath = PathToResourceAsFile(path); if (!File.Exists(cachePath)) { Logger.LogError(_TAG, $"{cachePath} is not found"); return(false); } var asset = File.ReadAllBytes(cachePath); using (var srcStr = new StdString(asset)) { srcStr.Swap(new StdString(dst, false)); } return(true); } catch (Exception e) { Logger.LogException(e); return(false); } }
protected override bool ReadFile(string path, IntPtr dst) { var localPath = CacheFileFromAsset(path); var asset = File.ReadAllBytes(localPath); using (var srcStr = new StdString(asset)) { srcStr.Swap(new StdString(dst, false)); } return(true); }
static bool ReadFile(string path, IntPtr dst) { var cachePath = CacheFileFromAsset(path); if (!File.Exists(cachePath)) { return(false); } var asset = File.ReadAllBytes(cachePath); using (var srcStr = new StdString(asset)) { srcStr.Swap(new StdString(dst, false)); } return(true); }
static bool ReadFile(string path, IntPtr dst) { try { Debug.Log(path); var localPath = CacheFileFromAsset(path); var asset = File.ReadAllBytes(localPath); using (var srcStr = new StdString(asset)) { srcStr.Swap(new StdString(dst, false)); } return(true); } catch (Exception e) { Debug.Log($"Failed to read file `{path}`: ${e.ToString()}"); return(false); } }