File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,8 +28,20 @@ class ReleaseDialog extends HookWidget {
2828 Widget build (BuildContext context) {
2929 final t = getLocalizations (context);
3030
31+ final updateScriptIsExists = useState (false );
32+
33+ useEffect (() {
34+ if (isWindows) {
35+ String resolvedExecutablePath = Platform .resolvedExecutable;
36+ String path = p.dirname (resolvedExecutablePath);
37+ String batFilePath = p.join (path, 'iris-updater.bat' );
38+ updateScriptIsExists.value = File (batFilePath).existsSync ();
39+ }
40+ return null ;
41+ }, []);
42+
3143 void update () async {
32- if (Platform . isWindows) {
44+ if (isWindows) {
3345 String resolvedExecutablePath = Platform .resolvedExecutable;
3446 String path = p.dirname (resolvedExecutablePath);
3547 String batFilePath = p.join (path, 'iris-updater.bat' );
@@ -81,7 +93,7 @@ class ReleaseDialog extends HookWidget {
8193 // ),
8294 // ),
8395 Visibility (
84- visible: isDesktop,
96+ visible: isDesktop && updateScriptIsExists.value ,
8597 child: TextButton (
8698 onPressed: update,
8799 child: Text (
You can’t perform that action at this time.
0 commit comments