File tree Expand file tree Collapse file tree
crates/rootbeer-core/src/lua Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -116,15 +116,17 @@ pub fn embedded_modules() -> &'static [(&'static str, &'static str)] {
116116#[ cfg( all( feature = "embedded-stdlib" , not( debug_assertions) ) ) ]
117117pub ( crate ) struct EmbeddedRequirer {
118118 inner : TextRequirer ,
119+ script_dir : PathBuf ,
119120 path : Vec < String > ,
120121 in_alias : bool ,
121122}
122123
123124#[ cfg( all( feature = "embedded-stdlib" , not( debug_assertions) ) ) ]
124125impl EmbeddedRequirer {
125- pub fn new ( ) -> Self {
126+ pub fn new ( script_dir : PathBuf ) -> Self {
126127 Self {
127128 inner : TextRequirer :: new ( ) ,
129+ script_dir,
128130 path : Vec :: new ( ) ,
129131 in_alias : false ,
130132 }
@@ -208,7 +210,11 @@ impl Require for EmbeddedRequirer {
208210 }
209211
210212 fn config ( & self ) -> io:: Result < Vec < u8 > > {
211- Ok ( format ! ( r#"{{"aliases":{{"rootbeer":"{EMBEDDED_SENTINEL}"}}}}"# ) . into_bytes ( ) )
213+ Ok ( format ! (
214+ r#"{{"aliases":{{"rootbeer":"{EMBEDDED_SENTINEL}","source":"{}"}}}}"# ,
215+ self . script_dir. display( )
216+ )
217+ . into_bytes ( ) )
212218 }
213219
214220 fn loader ( & self , lua : & Lua ) -> Result < Function > {
Original file line number Diff line number Diff line change @@ -82,7 +82,7 @@ fn make_require_fn(
8282 {
8383 let default_dir = std:: path:: PathBuf :: from ( env ! ( "ROOTBEER_LUA_DIR" ) ) ;
8484 if lua_dir == default_dir {
85- return lua. create_require_function ( EmbeddedRequirer :: new ( ) ) ;
85+ return lua. create_require_function ( EmbeddedRequirer :: new ( script_dir ) ) ;
8686 }
8787 }
8888
You can’t perform that action at this time.
0 commit comments