Skip to content

Commit

Permalink
Merge pull request #37 from karaagro/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
dkasiedu authored Jan 10, 2024
2 parents 0f784d7 + b49e71d commit 10e586b
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions lib/pages/setup/Setup.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'dart:io';
import 'dart:convert';
import 'package:cadi_ai/controllers/SetupController.dart';
import 'package:cadi_ai/entities/settings.dart';
import 'package:path_provider/path_provider.dart';

class Setup extends StatefulWidget {
const Setup({super.key});
Expand Down Expand Up @@ -99,12 +100,15 @@ class _SetupState extends State<Setup> {
await installPythonLibs();
return;
} else {
Directory appDocDir = await getApplicationDocumentsDirectory();
String appDocPath = appDocDir.path;

final pythonInstallation2 =
await checkPythonInstallation('Python310\\python.exe');
await checkPythonInstallation('$appDocPath\\Python310\\python.exe');
if (pythonInstallation2) {
await isarServices.addSetting(Settings()
..key = 'pythonCommand'
..value = 'Python310\\python.exe');
..value = '$appDocPath\\Python310\\python.exe');

setState(() {
step = "Python is already installed.";
Expand All @@ -126,15 +130,17 @@ class _SetupState extends State<Setup> {
setState(() {
step = "Installing python...";
});
final currentDirectory = Directory.current.path;

Directory appDocDir = await getApplicationDocumentsDirectory();
String appDocPath = appDocDir.path;

final process = await Process.start(
'python-installer.exe',
[
'/quiet',
'InstallAllUsers=1',
'Include_test=0',
'TargetDir=$currentDirectory\\Python310'
'TargetDir=$appDocPath\\Python310'
],
);

Expand All @@ -159,7 +165,7 @@ class _SetupState extends State<Setup> {
});
await isarServices.addSetting(Settings()
..key = 'pythonCommand'
..value = 'Python310\\python.exe');
..value = '$appDocPath\\Python310\\python.exe');
showAlertDialog(context);
} else {
if (kDebugMode) {
Expand Down

0 comments on commit 10e586b

Please sign in to comment.