mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-08 13:48:26 +00:00
Migrate wasmer-cli to new Context API
This commit is contained in:
committed by
Manos Pitsidianakis
parent
cf85615e55
commit
bc58b713db
@@ -258,6 +258,8 @@ pub fn get_cstr_path(ctx: ContextMut<'_, EmEnv>, path: *const i8) -> Option<std:
|
||||
for c in components.into_iter() {
|
||||
cumulative_path.push(c);
|
||||
if let Some(val) = data
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.mapped_dirs
|
||||
.get(&cumulative_path.to_string_lossy().to_string())
|
||||
{
|
||||
@@ -276,12 +278,19 @@ pub fn get_cstr_path(ctx: ContextMut<'_, EmEnv>, path: *const i8) -> Option<std:
|
||||
/// gets the current directory
|
||||
/// handles mapdir logic
|
||||
pub fn get_current_directory(ctx: ContextMut<'_, EmEnv>) -> Option<PathBuf> {
|
||||
if let Some(val) = get_emscripten_data(&ctx).mapped_dirs.get(".") {
|
||||
if let Some(val) = get_emscripten_data(&ctx)
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.mapped_dirs
|
||||
.get(".")
|
||||
{
|
||||
return Some(val.clone());
|
||||
}
|
||||
std::env::current_dir()
|
||||
.map(|cwd| {
|
||||
if let Some(val) = get_emscripten_data(&ctx)
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.mapped_dirs
|
||||
.get(&cwd.to_string_lossy().to_string())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user