Skip to content

Commit 2eb0e2d

Browse files
committed
继续兼容
1 parent 58fda6e commit 2eb0e2d

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

LuaParser/src/LuaParser.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,15 @@ using namespace std::filesystem;
1313

1414
std::shared_ptr<LuaParser> LuaParser::LoadFromFile(std::string_view filename)
1515
{
16-
path filePath(filename);
17-
std::string realPath = filePath.string();
16+
std::string realPath(filename);
1817
std::fstream fin(realPath, std::ios::in | std::ios::binary);
1918

2019
if (fin.is_open())
2120
{
2221
std::stringstream s;
2322
s << fin.rdbuf();
2423
auto parser = LoadFromBuffer(s.str());
25-
parser->SetFilename(filePath.filename().string());
24+
parser->SetFilename(realPath);
2625
return parser;
2726
}
2827

@@ -106,10 +105,10 @@ bool LuaParser::IsEmptyLine(int line)
106105

107106
void LuaParser::SetFilename(std::string_view filename)
108107
{
109-
std::filesystem::path path(filename);
110108
#ifdef NOT_SURPPORT_FILE_SYSTEM
111-
_file->SetFilename(path.string());
109+
_file->SetFilename(filename);
112110
#else
111+
std::filesystem::path path(filename);
113112
_file->SetFilename(path.replace_extension().string());
114113
#endif
115114

0 commit comments

Comments
 (0)