🐛 fix bug of incorrectly searching paths of lib.nas and dynamic libs.

`dylib.dlopen` now only needs file name of dynamic lib, not the real path.
This commit is contained in:
ValKmjolnir
2022-07-29 22:49:50 +08:00
parent 006ed644e6
commit 854850d9b1
12 changed files with 44 additions and 46 deletions
+7 -7
View File
@@ -64,24 +64,24 @@ string nasal_import::path(const nasal_ast& node)
string nasal_import::findf(const string& fname)
{
#ifdef _WIN32
std::vector<string> filepath={fname,"stl\\"+fname};
#else
std::vector<string> filepath={fname,"stl/"+fname};
#endif
std::vector<string> filepath={fname};
for(auto&p:envpath)
{
#ifdef _WIN32
filepath.push_back(p+"\\"+fname);
filepath.push_back(p+"\\stl\\"+fname);
#else
filepath.push_back(p+"/"+fname);
filepath.push_back(p+"/stl/"+fname);
#endif
}
for(auto& i:filepath)
if(access(i.c_str(),F_OK)!=-1)
return i;
if(fname=="lib.nas")
#ifdef _WIN32
return findf("stl\\lib.nas");
#else
return findf("stl/lib.nas");
#endif
if(!show_path)
{
nerr.err("link","cannot find file <"+fname+">");