diff --git a/lib/proton.dart b/lib/proton.dart index 9d3dc17..152826c 100644 --- a/lib/proton.dart +++ b/lib/proton.dart @@ -1,3 +1,6 @@ +import 'dart:io'; + +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:servermanager/settings.dart'; @@ -20,6 +23,36 @@ class ProtonState extends State { title: Text("Proton Manager"), backgroundColor: Color.fromARGB(255, 100, 0, 0), ), + body: SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.all(16), + child: Column(children: [ + ListTile( + title: Text("Init Prefix"), + subtitle: Text("Resets proton prefix"), + leading: Icon(CupertinoIcons.folder_fill), + onTap: () async { + Directory dir = Directory( + settings.game_path + Platform.pathSeparator + "pfx"); + // Invoke Proton and reset the prefix. + if (dir.existsSync()) { + await dir.delete(recursive: true); + + await dir.create(recursive: true); + } else { + await dir.create(recursive: true); + } + Platform.environment.putIfAbsent( + "STEAM_COMPAT_CLIENT_INSTALL_PATH", () => "~/.steam"); + Platform.environment + .putIfAbsent("STEAM_COMPAT_DATA_PATH", () => dir.path); + + await Process.run( + "proton", ["run", "this_program_does_not_exist.exe"]); + }, + ) + ]), + )), ); } }