Skip to content

Commit

Permalink
修复Windows下插件管理爆炸的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
XTxiaoting14332 committed Nov 2, 2024
1 parent b88b790 commit 72ba8b8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
13 changes: 2 additions & 11 deletions lib/ui/manage/manage_plugin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,8 @@ class _HomeScreenState extends State<ManagePlugin> {
void fileListener() async {
if (gOnOpen.isNotEmpty) {
final logWatcher = DirectoryWatcher(Bot.path());
_subscription = logWatcher.events.listen((event) async {
if (event.path == '${Bot.path()}/pyproject.toml' &&
event.type == ChangeType.MODIFY) {
setState(() {});
();
}
if (event.path == '${Bot.path()}/.disabled_plugins' &&
event.type == ChangeType.MODIFY) {
setState(() {});
();
}
_subscription = logWatcher.events.listen((event) {
setState(() {});
});
}
}
Expand Down
3 changes: 2 additions & 1 deletion lib/utils/core.dart
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ clearLog(path) async {
///从pyproject.toml中读取插件列表
List getPluginList() {
File pyprojectFile = File('${Bot.path()}/pyproject.toml');
String pyprojectContent = pyprojectFile.readAsStringSync();
pyprojectFile.writeAsStringSync(pyprojectFile.readAsStringSync().replaceAll('\r\n', '\n').replaceAll('\r', '\n'));
String pyprojectContent = pyprojectFile.readAsStringSync(encoding: systemEncoding);
List<String> linesWithoutComments = pyprojectContent
.split('\n')
.map((line) {
Expand Down

0 comments on commit 72ba8b8

Please sign in to comment.