Startup windows 확장자 체크
This commit is contained in:
parent
88a2aa70aa
commit
7fbc8f4f70
1 changed files with 8 additions and 3 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue