Skip to content
This repository was archived by the owner on Dec 1, 2023. It is now read-only.

Commit 6488e2b

Browse files
authored
Merge pull request #162 from redox-os/master
Fix for building on Redox
2 parents 78b4fd0 + b99dac2 commit 6488e2b

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/serialize.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1309,6 +1309,10 @@ array! {
13091309
}
13101310

13111311
impl Encodable for path::Path {
1312+
#[cfg(redox)]
1313+
fn encode<S: Encoder>(&self, e: &mut S) -> Result<(), S::Error> {
1314+
self.as_os_str().to_str().unwrap().encode(e)
1315+
}
13121316
#[cfg(unix)]
13131317
fn encode<S: Encoder>(&self, e: &mut S) -> Result<(), S::Error> {
13141318
use std::os::unix::prelude::*;
@@ -1329,6 +1333,14 @@ impl Encodable for path::PathBuf {
13291333
}
13301334

13311335
impl Decodable for path::PathBuf {
1336+
#[cfg(redox)]
1337+
fn decode<D: Decoder>(d: &mut D) -> Result<path::PathBuf, D::Error> {
1338+
let string: String = try!(Decodable::decode(d));
1339+
let s: OsString = OsString::from(string);
1340+
let mut p = path::PathBuf::new();
1341+
p.push(s);
1342+
Ok(p)
1343+
}
13321344
#[cfg(unix)]
13331345
fn decode<D: Decoder>(d: &mut D) -> Result<path::PathBuf, D::Error> {
13341346
use std::os::unix::prelude::*;

0 commit comments

Comments
 (0)