about summary refs log tree commit diff
path: root/tvix/eval/src/vm.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tvix/eval/src/vm.rs')
-rw-r--r--tvix/eval/src/vm.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/tvix/eval/src/vm.rs b/tvix/eval/src/vm.rs
index 05adec5f6e..7fcdb9ea73 100644
--- a/tvix/eval/src/vm.rs
+++ b/tvix/eval/src/vm.rs
@@ -536,6 +536,26 @@ impl<'o> VM<'o> {
                 _ => panic!("tvix compiler bug: OpFindFile called on non-UnresolvedPath"),
             },
 
+            OpCode::OpResolveHomePath => match self.pop() {
+                Value::UnresolvedPath(path) => {
+                    match dirs::home_dir() {
+                        None => {
+                            return Err(self.error(ErrorKind::PathResolution(
+                                "failed to determine home directory".into(),
+                            )));
+                        }
+                        Some(mut buf) => {
+                            buf.push(path);
+                            self.push(buf.into());
+                        }
+                    };
+                }
+
+                _ => {
+                    panic!("tvix compiler bug: OpResolveHomePath called on non-UnresolvedPath")
+                }
+            },
+
             OpCode::OpJump(JumpOffset(offset)) => {
                 debug_assert!(offset != 0);
                 self.frame_mut().ip += offset;