Skip to content

Commit

Permalink
Add wasm support
Browse files Browse the repository at this point in the history
  • Loading branch information
stevepentland committed Feb 22, 2018
1 parent 4e45a46 commit 689949e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/app/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::ffi::{OsStr, OsString};
use std::fmt::Display;
use std::fs::File;
use std::io::{self, BufWriter, Write};
#[cfg(feature = "debug")]
#[cfg(all(feature = "debug", not(target_arch = "wasm32")))]
use std::os::unix::ffi::OsStrExt;
use std::path::PathBuf;
use std::slice::Iter;
Expand Down Expand Up @@ -657,9 +657,9 @@ where
fn possible_subcommand(&self, arg_os: &OsStr) -> (bool, Option<&str>) {
debugln!("Parser::possible_subcommand: arg={:?}", arg_os);
fn starts(h: &str, n: &OsStr) -> bool {
#[cfg(not(target_os = "windows"))]
#[cfg(not(any(target_os = "windows", target_arch = "wasm32")))]
use std::os::unix::ffi::OsStrExt;
#[cfg(target_os = "windows")]
#[cfg(any(target_os = "windows", target_arch = "wasm32"))]
use osstringext::OsStrExt3;

let n_bytes = n.as_bytes();
Expand Down
4 changes: 2 additions & 2 deletions src/args/arg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
use std::collections::BTreeMap;
use std::rc::Rc;
use std::ffi::{OsStr, OsString};
#[cfg(target_os = "windows")]
#[cfg(any(target_os = "windows", target_arch = "wasm32"))]
use osstringext::OsStrExt3;
#[cfg(not(target_os = "windows"))]
#[cfg(not(any(target_os = "windows", target_arch = "wasm32")))]
use std::os::unix::ffi::OsStrExt;
use std::env;

Expand Down
6 changes: 3 additions & 3 deletions src/osstringext.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#[cfg(target_os = "windows")]
#[cfg(any(target_os = "windows", target_arch = "wasm32"))]
use INVALID_UTF8;
use std::ffi::OsStr;
#[cfg(not(target_os = "windows"))]
#[cfg(not(any(target_os = "windows", target_arch = "wasm32")))]
use std::os::unix::ffi::OsStrExt;

#[cfg(target_os = "windows")]
#[cfg(any(target_os = "windows", target_arch = "wasm32"))]
pub trait OsStrExt3 {
fn from_bytes(b: &[u8]) -> &Self;
fn as_bytes(&self) -> &[u8];
Expand Down

0 comments on commit 689949e

Please sign in to comment.