mirror of
https://github.com/luau-lang/luau.git
synced 2025-04-20 19:53:48 +01:00
Do not store file extensions in module chunknames [Luau CLI] (#1772)
This commit is contained in:
parent
a8d14596e7
commit
50f32a1400
1 changed files with 8 additions and 1 deletions
|
@ -581,7 +581,14 @@ static bool runFile(const char* name, lua_State* GL, bool repl)
|
||||||
// new thread needs to have the globals sandboxed
|
// new thread needs to have the globals sandboxed
|
||||||
luaL_sandboxthread(L);
|
luaL_sandboxthread(L);
|
||||||
|
|
||||||
std::string chunkname = "@" + std::string(name);
|
// ignore file extension when storing module's chunkname
|
||||||
|
std::string chunkname = "@";
|
||||||
|
std::string_view nameView = name;
|
||||||
|
if (size_t dotPos = nameView.find_last_of('.'); dotPos != std::string_view::npos)
|
||||||
|
{
|
||||||
|
nameView.remove_suffix(nameView.size() - dotPos);
|
||||||
|
}
|
||||||
|
chunkname += nameView;
|
||||||
|
|
||||||
std::string bytecode = Luau::compile(*source, copts());
|
std::string bytecode = Luau::compile(*source, copts());
|
||||||
int status = 0;
|
int status = 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue