Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support windows build #7

Merged
merged 1 commit into from
Aug 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 33 additions & 15 deletions src/clib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ use genome_graph::bigraph::traitgraph::interface::{
};
use genome_graph::bigraph::traitgraph::traitsequence::interface::Sequence;
use log::LevelFilter;
use std::ffi::{CStr, CString, OsString};
#[cfg(unix)]
use std::ffi::OsString;
use std::ffi::{CStr, CString};
use std::os::raw::c_char;
#[cfg(unix)]
use std::os::unix::ffi::OsStringExt;
use std::path::PathBuf;
use std::time::Instant;
Expand Down Expand Up @@ -279,23 +282,38 @@ pub unsafe extern "C" fn matchtigs_compute_tigs(
get_graph().edge_count()
);

let matching_file_prefix = PathBuf::from(OsString::from_vec(
CString::from({
assert!(!matching_file_prefix.is_null());
let matching_file_prefix = CString::from({
assert!(!matching_file_prefix.is_null());

CStr::from_ptr(matching_file_prefix)
})
.into_bytes();
let matching_file_prefix = match () {
#[cfg(unix)]
() => PathBuf::from(OsString::from_vec(matching_file_prefix)),
#[cfg(not(unix))]
() => PathBuf::from(
&std::str::from_utf8(matching_file_prefix.as_slice())
.expect("Invalid encoding for matching file prefix"),
),
};

CStr::from_ptr(matching_file_prefix)
})
.into_bytes(),
));
let matcher_path = CString::from({
assert!(!matcher_path.is_null());

let matcher_path = PathBuf::from(OsString::from_vec(
CString::from({
assert!(!matcher_path.is_null());
CStr::from_ptr(matcher_path)
})
.into_bytes();

CStr::from_ptr(matcher_path)
})
.into_bytes(),
));
let matcher_path = match () {
#[cfg(unix)]
() => PathBuf::from(OsString::from_vec(matcher_path)),
#[cfg(not(unix))]
() => PathBuf::from(
&std::str::from_utf8(matcher_path.as_slice())
.expect("Invalid encoding for matcher path"),
),
};

let tigs_edge_out = {
assert!(!tigs_edge_out.is_null());
Expand Down
Loading