fix: #191 : Download reported has successful on readonly storage
This commit is contained in:
parent
94b98c5048
commit
e8b430c909
|
@ -190,3 +190,9 @@ msgstr "Loading available downloads"
|
|||
|
||||
msgid "Powered by"
|
||||
msgstr "Powered by"
|
||||
|
||||
msgid "Error"
|
||||
msgstr "Error"
|
||||
|
||||
msgid "Could not write to the working directory. Please check the permissions."
|
||||
msgstr "Could not write to the working directory. Please check the permissions."
|
||||
|
|
|
@ -185,6 +185,12 @@ msgstr "Nom d'utilisateur SSH"
|
|||
msgid "Connect"
|
||||
msgstr "Connecter"
|
||||
|
||||
msgid "Error"
|
||||
msgstr "Erreur"
|
||||
|
||||
msgid "Could not write to the working directory. Please check the permissions."
|
||||
msgstr "Impossible d'écrire dans le répertoire de travail. Veuillez vérifier les permissions."
|
||||
|
||||
msgid "Loading available downloads"
|
||||
msgstr "Chargement des téléchargements disponibles"
|
||||
|
||||
|
|
|
@ -187,6 +187,12 @@ msgstr ""
|
|||
msgid "Connect"
|
||||
msgstr ""
|
||||
|
||||
msgid "Error"
|
||||
msgstr ""
|
||||
|
||||
msgid "Could not write to the working directory. Please check the permissions."
|
||||
msgstr ""
|
||||
|
||||
msgid "Loading available downloads"
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@ import 'dart:io';
|
|||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gettext_i18n/gettext_i18n.dart';
|
||||
import 'package:quickgui/src/globals.dart';
|
||||
import 'package:quickgui/src/mixins/preferences_mixin.dart';
|
||||
import 'package:tuple/tuple.dart';
|
||||
|
||||
import '../../model/operating_system.dart';
|
||||
|
@ -19,7 +21,8 @@ class HomePageButtonGroup extends StatefulWidget {
|
|||
State<HomePageButtonGroup> createState() => _HomePageButtonGroupState();
|
||||
}
|
||||
|
||||
class _HomePageButtonGroupState extends State<HomePageButtonGroup> {
|
||||
class _HomePageButtonGroupState extends State<HomePageButtonGroup>
|
||||
with PreferencesMixin {
|
||||
OperatingSystem? _selectedOperatingSystem;
|
||||
Version? _selectedVersion;
|
||||
Option? _selectedOption;
|
||||
|
@ -85,16 +88,50 @@ class _HomePageButtonGroupState extends State<HomePageButtonGroup> {
|
|||
text: context.t('Download'),
|
||||
onPressed: (_selectedVersion == null)
|
||||
? null
|
||||
: () {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (context) => Downloader(
|
||||
operatingSystem: _selectedOperatingSystem!,
|
||||
version: _selectedVersion!,
|
||||
option: _selectedOption,
|
||||
: () async {
|
||||
final workingDirectory =
|
||||
await getPreference<String>(prefWorkingDirectory);
|
||||
final tmpFile = File("$workingDirectory/modecheck.tmp");
|
||||
if (tmpFile.existsSync()) {
|
||||
tmpFile.deleteSync();
|
||||
}
|
||||
try {
|
||||
tmpFile.createSync();
|
||||
} catch (e) {
|
||||
// Do nothing
|
||||
}
|
||||
if (tmpFile.existsSync()) {
|
||||
tmpFile.deleteSync();
|
||||
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (context) => Downloader(
|
||||
operatingSystem: _selectedOperatingSystem!,
|
||||
version: _selectedVersion!,
|
||||
option: _selectedOption,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
);
|
||||
} else {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: Text(context.t('Error')),
|
||||
content: Text(
|
||||
context.t(
|
||||
'Could not write to the working directory. Please check the permissions.'),
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: Text(context.t('OK')),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
|
|
Loading…
Reference in New Issue