stop converting relative paths to absolute
prevented downstream users from utilizing `PathSearcher` in binary
This commit is contained in:
@@ -6,7 +6,6 @@ use std::io::Read;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
use crate::types::Result;
|
||||
use crate::utils;
|
||||
|
||||
/// Stores Lua modules indexed by module name, and provides an `rlua::MetaMethod`
|
||||
/// to enable `require`ing the stored modules by name in an `rlua::Context`.
|
||||
@@ -113,17 +112,8 @@ where
|
||||
methods.add_meta_method(MetaMethod::Call, |lua_ctx, this, name: String| {
|
||||
match this.modules.get(&name) {
|
||||
Some(ref path) => {
|
||||
let path = path.as_ref();
|
||||
|
||||
// Ensure `path` is relative to `$CARGO_MANIFEST_DIR`.
|
||||
let path = if path.is_relative() {
|
||||
utils::runtime_root().join(path)
|
||||
} else {
|
||||
path.to_path_buf()
|
||||
};
|
||||
|
||||
let path = path.as_ref().to_path_buf();
|
||||
let content = (this.transform)(path)?;
|
||||
|
||||
Ok(Value::Function(
|
||||
lua_ctx
|
||||
.load(&content)
|
||||
|
Reference in New Issue
Block a user