From 8faeb9f5ccbda0186c1f3073abc2d678b031452d Mon Sep 17 00:00:00 2001 From: iceiix <43691553+iceiix@users.noreply.github.com> Date: Wed, 29 May 2019 08:21:56 -0700 Subject: [PATCH] wasm: Fix operation not supported on std::fs. Closes #115 (#166) * Add new web-based std::fs replacement, localstoragefs: https://github.com/iceiix/localstoragefs * Add std_or_web to switch between std::fs (native) or localstoragefs (web) * Update www readme for new missing glutin/winit links, opens issue #171 --- protocol/src/protocol/mod.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/protocol/src/protocol/mod.rs b/protocol/src/protocol/mod.rs index 0514312..18b251d 100644 --- a/protocol/src/protocol/mod.rs +++ b/protocol/src/protocol/mod.rs @@ -19,6 +19,7 @@ use aes::Aes128; use cfb8::Cfb8; use cfb8::stream_cipher::{NewStreamCipher, StreamCipher}; use serde_json; +use std_or_web::fs; #[cfg(not(target_arch = "wasm32"))] use reqwest; @@ -1070,7 +1071,7 @@ impl Conn { if network_debug { debug!("about to parse id={:x}, dir={:?} state={:?}", id, dir, self.state); - std::fs::File::create("last-packet")?.write_all(buf.get_ref())?; + fs::File::create("last-packet")?.write_all(buf.get_ref())?; } let packet = packet::packet_by_id(self.protocol_version, self.state, dir, id, &mut buf)?;