@@ -39,22 +39,16 @@ void Env::LoadModule(const std::filesystem::path& file)
3939 _loaded_modules.erase (file.filename ().string ());
4040 }
4141
42- const auto new_module_file = std::filesystem::current_path () / " modules" / file.filename ();
43- if (new_module_file != file)
44- {
45- std::filesystem::copy_file (file, new_module_file, std::filesystem::copy_options::overwrite_existing);
46- }
47-
4842#ifdef FLOW_WINDOWS
49- HINSTANCE handle = LoadLibrary (new_module_file .string ().c_str ());
43+ HINSTANCE handle = LoadLibrary (file .string ().c_str ());
5044 if (!handle)
5145 {
52- throw std::runtime_error (" Error loading file: " + new_module_file .string ());
46+ throw std::runtime_error (" Error loading file: " + file .string ());
5347 }
5448
5549 auto register_func = GetProcAddress (handle, NodeFactory::RegisterModuleFuncName);
5650#else
57- void * handle = dlopen (new_module_file .c_str (), RTLD_LAZY);
51+ void * handle = dlopen (file .c_str (), RTLD_LAZY);
5852 if (!handle)
5953 {
6054 throw std::runtime_error (" Error loading file: " + std::string (dlerror ()));
@@ -66,7 +60,7 @@ void Env::LoadModule(const std::filesystem::path& file)
6660 if (auto RegisterModule_func = std::bit_cast<NodeFactory::ModuleMethod_t>(register_func))
6761 {
6862 RegisterModule_func (_factory);
69- _loaded_modules.emplace (new_module_file .filename ().string (), std::bit_cast<void *>(handle));
63+ _loaded_modules.emplace (file .filename ().string (), std::bit_cast<void *>(handle));
7064 return ;
7165 }
7266
@@ -75,7 +69,7 @@ void Env::LoadModule(const std::filesystem::path& file)
7569#else
7670 dlclose (handle);
7771#endif
78- throw std::runtime_error (" Error loading symbol for RegisterModule from " + new_module_file .filename ().string ());
72+ throw std::runtime_error (" Error loading symbol for RegisterModule from " + file .filename ().string ());
7973}
8074
8175void Env::LoadModules (const std::filesystem::path& extension_path)
0 commit comments