@@ -35,26 +35,28 @@ auto migratePlugin(const std::filesystem::path& path) -> void {
3535
3636 const auto & pluginType = pluginManager.getType ();
3737
38- const auto & pluginName = path.filename ();
39- const auto & pluginBaseName = path.stem ();
40- const auto & pluginDir = ll::plugin::getPluginsRoot () / pluginBaseName ;
38+ const auto & pluginFileName = path.filename ();
39+ const auto & pluginFileBaseName = path.stem ();
40+ const auto & pluginDir = ll::plugin::getPluginsRoot () / pluginFileBaseName ;
4141
42- if (std::filesystem::exists (pluginDir / path. filename () )) {
42+ if (std::filesystem::exists (pluginDir / pluginFileName )) {
4343 throw std::runtime_error (
4444 fmt::format (" failed to migrate legacy plugin at {}: {} already exists" , path.string (), pluginDir.string ())
4545 );
4646 }
4747
48- if (!std::filesystem::create_directory (pluginDir) && !std::filesystem::exists (pluginDir)) {
49- throw std::runtime_error (fmt::format (" failed to create directory {}" , pluginDir.string ()));
48+ if (!std::filesystem::exists (pluginDir)) {
49+ if (!std::filesystem::create_directory (pluginDir)) {
50+ throw std::runtime_error (fmt::format (" failed to create directory {}" , pluginDir.string ()));
51+ }
5052 }
5153
5254 // Move plugin file.
53- std::filesystem::rename (path, pluginDir / pluginName );
55+ std::filesystem::rename (path, pluginDir / pluginFileName );
5456
5557 ll::plugin::Manifest manifest{
56- .entry = pluginName .string (),
57- .name = pluginBaseName .string (),
58+ .entry = pluginFileName .string (),
59+ .name = pluginFileBaseName .string (),
5860 .type = pluginType,
5961 .dependencies =
6062 std::unordered_set<ll::plugin::Dependency>{
0 commit comments