From 7fbc8f4f70de278674c5821fe2f48c00a71e77e8 Mon Sep 17 00:00:00 2001 From: toki Date: Wed, 25 Jan 2023 17:41:41 +0900 Subject: [PATCH] =?UTF-8?q?Startup=20windows=20=ED=99=95=EC=9E=A5=EC=9E=90?= =?UTF-8?q?=20=EC=B2=B4=ED=81=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/utils/os_startup.dart | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/utils/os_startup.dart b/lib/utils/os_startup.dart index 6766276..731f771 100644 --- a/lib/utils/os_startup.dart +++ b/lib/utils/os_startup.dart @@ -254,9 +254,11 @@ class _StartupWindows extends _Startup { var exist = false; var userPath = Platform.environment['UserProfile']; var startupDir = Directory('$userPath$windowsStartupPath'); - var files = await startupDir.listSync(); + var files = startupDir.listSync(); for (var fileEntry in files) { var fileName = path.basename(fileEntry.path); + var extension = path.extension(fileName); + fileName = fileName.replaceAll(extension, ''); if (fileName == label) { exist = true; break; @@ -278,7 +280,8 @@ class _StartupWindows extends _Startup { //For Windows 8, 10 var fileName = path.basename(file.path); var extension = path.extension(fileName); - var symbolicPath = '%userprofile%$windowsStartupPath$label$extension'; + var userPath = Platform.environment['UserProfile']; + var symbolicPath = '$userPath$windowsStartupPath$label$extension'; result = await ProcessExecutor.run( StringBuffer('mklink "$symbolicPath" "$executableFilePath"')); c.complete(result.exitCode == 0); @@ -292,9 +295,11 @@ class _StartupWindows extends _Startup { //For Windows 8, 10 var userPath = Platform.environment['UserProfile']; var startupDir = Directory('$userPath$windowsStartupPath'); - var files = await startupDir.listSync(); + var files = startupDir.listSync(); for (var fileEntry in files) { var fileName = path.basename(fileEntry.path); + var extension = path.extension(fileName); + fileName = fileName.replaceAll(extension, ''); if (fileName == label) { await File(fileEntry.path).delete(); success = true;