Skip to content

Commit d3fec3a

Browse files
committed
fix: plugin migration
1 parent 44b65d3 commit d3fec3a

File tree

5 files changed

+11
-35
lines changed

5 files changed

+11
-35
lines changed

CHANGELOG.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2323

2424
- First release.
2525

26-
[0.1.5]: https://github.com/LiteLDev/LegacyScriptEngine/compare/v0.1.4...v0.1.5
27-
2826
[0.1.6]: https://github.com/LiteLDev/LegacyScriptEngine/compare/v0.1.5...v0.1.6
2927
[0.1.5]: https://github.com/LiteLDev/LegacyScriptEngine/compare/v0.1.4...v0.1.5
3028
[0.1.4]: https://github.com/LiteLDev/LegacyScriptEngine/releases/tag/v0.1.4

README.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,6 @@ A plugin engine for running LLSE plugins on LeviLamina
44

55
## Install
66

7-
Before you install LegacyScriptEgnine, you need to install dependencies firstly:
8-
9-
```sh
10-
lip install github.com/LiteLDev/LegacyMoney
11-
lip install github.com/LiteLDev/LegacyRemoteCall
12-
lip install github.com/LiteLDev/LegacyParticleAPI
13-
```
14-
157
To install all engines as a whole, you can use the following command:
168

179
```sh

docs/index.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,6 @@ A plugin engine for running LLSE plugins on LeviLamina
44

55
## Install
66

7-
Before you install LegacyScriptEgnine, you need to install dependencies firstly:
8-
9-
```sh
10-
lip install github.com/LiteLDev/LegacyMoney
11-
lip install github.com/LiteLDev/LegacyRemoteCall
12-
lip install github.com/LiteLDev/LegacyParticleAPI
13-
```
14-
157
To install all engines as a whole, you can use the following command:
168

179
```sh

docs/index.zh.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,6 @@
44

55
## 安装
66

7-
在安装 LegacyScriptEngine 之前,您需要先安装依赖项:
8-
9-
```sh
10-
lip install github.com/LiteLDev/LegacyMoney
11-
lip install github.com/LiteLDev/LegacyRemoteCall
12-
lip install github.com/LiteLDev/LegacyParticleAPI
13-
```
14-
157
要一次性安装所有引擎,您可以使用以下命令:
168

179
```sh

src/lse/PluginMigration.cpp

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)