diff --git a/src/acpi/aml/namespace.rs b/src/acpi/aml/namespace.rs index 9c7f564574792579f47c0700229dd0101d3a41c9..8c18f1a3cd67dedb9fec880b1051578ae8b89db4 100644 --- a/src/acpi/aml/namespace.rs +++ b/src/acpi/aml/namespace.rs @@ -1,5 +1,6 @@ use alloc::boxed::Box; use collections::string::String; +use collections::string::ToString; use collections::vec::Vec; use core::fmt::{Debug, Formatter, Error}; @@ -174,7 +175,7 @@ impl Method { pub fn get_namespace_string(current: String, modifier_v: AmlValue) -> String { // TODO: Type error if modifier not string - let modifier = if let Ok(s) = modifier_v.get_as_string() { + let mut modifier = if let Ok(s) = modifier_v.get_as_string() { s } else { return current; @@ -192,12 +193,15 @@ pub fn get_namespace_string(current: String, modifier_v: AmlValue) -> String { return modifier; } + let mut namespace = current.clone(); + if modifier.starts_with("^") { - // TODO + while modifier.starts_with("^") { + modifier = modifier[1..].to_string(); + while namespace.pop() != Some('.') { } + } } - let mut namespace = current.clone(); - if !namespace.ends_with("\\") { namespace.push('.'); }