mirror of
https://github.com/StarCitizenToolBox/app.git
synced 2026-02-06 15:10:20 +00:00
feat: linux support
This commit is contained in:
@@ -8,7 +8,15 @@ import 'package:starcitizen_doctor/common/utils/log.dart';
|
||||
|
||||
class SCLoggerHelper {
|
||||
static Future<String?> getLogFilePath() async {
|
||||
if (!Platform.isWindows) return null;
|
||||
if (!Platform.isWindows) {
|
||||
final wineUserPath = await getWineUserPath();
|
||||
if (wineUserPath == null) return null;
|
||||
// /home/xkeyc/Games/star-citizen/drive_c/users/xkeyc/AppData/Roaming/rsilauncher/
|
||||
final rsiLauncherPath = "$wineUserPath/AppData/Roaming/rsilauncher";
|
||||
dPrint("rsiLauncherPath Wine:$rsiLauncherPath");
|
||||
final jsonLogPath = "$rsiLauncherPath/logs/log.log";
|
||||
return jsonLogPath;
|
||||
};
|
||||
Map<String, String> envVars = Platform.environment;
|
||||
final appDataPath = envVars["appdata"];
|
||||
if (appDataPath == null) {
|
||||
@@ -21,6 +29,14 @@ class SCLoggerHelper {
|
||||
}
|
||||
|
||||
static Future<String?> getShaderCachePath() async {
|
||||
if (!Platform.isWindows) {
|
||||
final wineUserPath = await getWineUserPath();
|
||||
if (wineUserPath == null) return null;
|
||||
// /home/xkeyc/Games/star-citizen/drive_c/users/xkeyc/AppData/Local/star citizen/
|
||||
final scCachePath = "$wineUserPath/AppData/Local/star citizen";
|
||||
dPrint("getShaderCachePath Wine === $scCachePath");
|
||||
return scCachePath;
|
||||
}
|
||||
Map<String, String> envVars = Platform.environment;
|
||||
final appDataPath = envVars["LOCALAPPDATA"];
|
||||
if (appDataPath == null) {
|
||||
@@ -31,6 +47,23 @@ class SCLoggerHelper {
|
||||
return scCachePath;
|
||||
}
|
||||
|
||||
static Future<String?> getWineUserPath() async {
|
||||
// get game path in hiveBox
|
||||
final confBox = await Hive.openBox("app_conf");
|
||||
final path = confBox.get("custom_game_path");
|
||||
if (path?.isEmpty ?? true) return null;
|
||||
// path eg: /home/xkeyc/Games/star-citizen/drive_c/Program Files/Roberts Space Industries/StarCitizen/LIVE/
|
||||
// resolve wine c_drive path
|
||||
final wineCDrivePath = path.toString().split('/drive_c/').first;
|
||||
// scan wine user path == current_unix_user
|
||||
final wineUserPath = "$wineCDrivePath/drive_c/users/${Platform.environment['USER']}";
|
||||
// check exists
|
||||
final wineUserDir = Directory(wineUserPath);
|
||||
if (!await wineUserDir.exists()) return null;
|
||||
dPrint("getWineUserPath === $wineUserPath");
|
||||
return wineUserPath;
|
||||
}
|
||||
|
||||
static Future<List?> getLauncherLogList() async {
|
||||
if (!Platform.isWindows) return [];
|
||||
try {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:hive_ce/hive.dart';
|
||||
import 'package:starcitizen_doctor/common/utils/base_utils.dart';
|
||||
import 'package:starcitizen_doctor/common/utils/log.dart';
|
||||
import 'package:starcitizen_doctor/common/rust/api/win32_api.dart' as win32;
|
||||
|
||||
@@ -41,7 +42,7 @@ class SystemHelper {
|
||||
if (path != null && path != "") {
|
||||
if (await File(path).exists()) {
|
||||
if (skipEXE) {
|
||||
return "${path.toString().replaceAll("\\RSI Launcher.exe", "")}\\";
|
||||
return "${path.toString().replaceAll("\\RSI Launcher.exe".platformPath, "")}\\".platformPath;
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:desktop_multi_window/desktop_multi_window.dart';
|
||||
import 'package:fluent_ui/fluent_ui.dart';
|
||||
@@ -112,7 +113,7 @@ class MultiWindowManager {
|
||||
|
||||
await Window.initialize();
|
||||
|
||||
if (windowAppState.windowsVersion >= 10) {
|
||||
if (Platform.isWindows && windowAppState.windowsVersion >= 10) {
|
||||
await Window.setEffect(effect: WindowEffect.acrylic);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user