Make some windows specific fixes

This commit is contained in:
zontreck 2024-11-24 23:44:59 -07:00
parent a3d263cd99
commit 2998f87f13
8 changed files with 44 additions and 19 deletions

View file

@ -25,7 +25,7 @@ FROM git.zontreck.com/ariascreations/yolks:wine_8.0
WORKDIR /app WORKDIR /app
COPY --from=BUILDER /app/out/server /app/server COPY --from=BUILDER /app/out/cemmserver /app/server
COPY --from=RCONBUILD /app/mcrcon/mcrcon /app/rcon COPY --from=RCONBUILD /app/mcrcon/mcrcon /app/rcon

4
Jenkinsfile vendored
View file

@ -69,9 +69,7 @@ pipeline {
steps { steps {
script { script {
bat 'flutter pub get' bat 'flutter pub get'
bat 'flutter build windows' bat 'call compile.bat'
bat 'mkdir out'
bat 'dart compile exe -o out\\server.exe bin\\server.dart'
} }
} }

View file

@ -20,7 +20,7 @@ void main() async {
await settings.Read(); await settings.Read();
print( print(
"Server Admin Credentials\nUsername: ${settings.superuser.name}\nPassword (Default): changeMe123\n\n"); "Server Admin Credentials\n> Username: ${settings.superuser.name}\n> Password (Default): changeMe123\n\n");
PathHelper helper = PathHelper(pth: Directory.current.path); PathHelper helper = PathHelper(pth: Directory.current.path);
helper = helper.resolve("data").mkdir(); helper = helper.resolve("data").mkdir();

View file

@ -1,3 +1,6 @@
@echo off @echo off
call flutter pub get
call flutter build windows call flutter build windows
mkdir out
call dart compile exe -o out\cemmserver.exe bin\server.dart

View file

@ -14,7 +14,7 @@ then
fi fi
dart compile exe -o out/server bin/server.dart dart compile exe -o out/cemmserver bin/server.dart
rsync -a --progress -h --delete build/linux/x64/release/bundle/ out/client/ rsync -a --progress -h --delete build/linux/x64/release/bundle/ out/client/
if [ -f RELEASE ] if [ -f RELEASE ]

View file

@ -1,3 +1,3 @@
class Consts { class Consts {
static const VERSION = "1.1.112324.1959"; static const VERSION = "1.1.112424.2344";
} }

View file

@ -4,7 +4,15 @@ import 'package:libac_dart/utils/IOTools.dart';
import 'package:servermanager/statemachine.dart'; import 'package:servermanager/statemachine.dart';
import 'package:servermanager/structs/settings.dart'; import 'package:servermanager/structs/settings.dart';
// A patch to allow windows to run software using the below methods.
Future<bool> requiresWine() async {
if (Platform.isWindows) return false;
return true;
}
Future<void> runWine(String command, List<String> argx) async { Future<void> runWine(String command, List<String> argx) async {
bool requiredWine = await requiresWine();
Settings settings = Settings(); Settings settings = Settings();
Directory dir = Directory(settings.getWinePrefixPath()); Directory dir = Directory(settings.getWinePrefixPath());
@ -20,11 +28,16 @@ Future<void> runWine(String command, List<String> argx) async {
List<String> args = [command]; List<String> args = [command];
args.addAll(argx); args.addAll(argx);
ProcessResult res = await Process.run( ProcessResult? res;
if (requiredWine)
res = await Process.run(
"wine", "wine",
args, // Run arbitrary command with arguments args, // Run arbitrary command with arguments
environment: env, environment: env,
); );
else
res = await Process.run(args[0], args.length > 1 ? args.sublist(1) : [],
environment: {});
print('Exit code: ${res.exitCode}'); print('Exit code: ${res.exitCode}');
print('stdout: ${res.stdout}'); print('stdout: ${res.stdout}');
@ -35,6 +48,8 @@ Future<void> runWine(String command, List<String> argx) async {
} }
Future<void> runWinetrick(String trick) async { Future<void> runWinetrick(String trick) async {
if (!(await requiresWine())) return;
Settings settings = Settings(); Settings settings = Settings();
Directory dir = Directory(settings.getWinePrefixPath()); Directory dir = Directory(settings.getWinePrefixPath());
@ -65,6 +80,8 @@ Future<void> runWinetrick(String trick) async {
Future<void> runDetachedWine( Future<void> runDetachedWine(
String command, List<String> argx, String workingDir) async { String command, List<String> argx, String workingDir) async {
bool requiredWine = await requiresWine();
Settings settings = Settings(); Settings settings = Settings();
Directory dir = Directory dir =
Directory(PathHelper.builder(settings.base_path).resolve("pfx").build()); Directory(PathHelper.builder(settings.base_path).resolve("pfx").build());
@ -81,11 +98,18 @@ Future<void> runDetachedWine(
List<String> args = [command]; List<String> args = [command];
args.addAll(argx); args.addAll(argx);
if (requiredWine)
StateMachine.PROC = await Process.start( StateMachine.PROC = await Process.start(
"wine", args, // Run arbitrary command with arguments "wine", args, // Run arbitrary command with arguments
environment: env, environment: env,
workingDirectory: workingDir, workingDirectory: workingDir,
mode: ProcessStartMode.detachedWithStdio); mode: ProcessStartMode.detachedWithStdio);
else
StateMachine.PROC = await Process.start(
args[0], args.length > 1 ? args.sublist(1) : [],
environment: {},
workingDirectory: workingDir,
mode: ProcessStartMode.detachedWithStdio);
try { try {
StateMachine.PROC!.stdout.forEach((line) {}); StateMachine.PROC!.stdout.forEach((line) {});

View file

@ -16,7 +16,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts # In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix. # of the product and file versions while build-number is used as the build suffix.
version: 1.1.112324+1959 version: 1.1.112424+2344
environment: environment:
sdk: ">=3.1.4 <4.0.0" sdk: ">=3.1.4 <4.0.0"