Add a proton init function

This commit is contained in:
Zontreck 2023-11-03 01:09:29 -07:00
parent f15a1f4fbc
commit 711eb44270

View file

@ -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<Proton> {
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"]);
},
)
]),
)),
);
}
}