mirror of
https://github.com/Drop-OSS/drop-app.git
synced 2025-11-10 04:22:13 +10:00
refactor(compat): remove unnecessary compat code (#20)
* Delete pages/settings/compatibility.vue * Update settings.vue * Update debug.vue * Update lib.rs * Update compat.rs
This commit is contained in:
@ -73,11 +73,6 @@ const navigation: Array<NavigationItem & { icon: Component }> = [
|
||||
];
|
||||
|
||||
const currentPlatform = platform();
|
||||
switch (currentPlatform) {
|
||||
case "linux":
|
||||
navigation.splice(2, 0, { label: "Compatibility", route: "/settings/compatibility", prefix: "/settings/compatibility", icon: CubeIcon });
|
||||
break;
|
||||
}
|
||||
|
||||
const currentPageIndex = useCurrentNavigationIndex(navigation);
|
||||
</script>
|
||||
|
||||
@ -1,3 +0,0 @@
|
||||
<template>
|
||||
|
||||
</template>
|
||||
@ -58,26 +58,6 @@
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div v-if="compatInfo">
|
||||
<div class="flex items-center gap-x-3">
|
||||
<CubeIcon class="h-5 w-5 text-zinc-400" />
|
||||
<h3 class="text-sm font-medium leading-6 text-zinc-100">
|
||||
Compatibility Settings
|
||||
</h3>
|
||||
</div>
|
||||
<div class="mt-2 ml-8 space-y-1">
|
||||
<p class="text-sm text-zinc-400 font-mono">
|
||||
Enabled: {{ compatInfo.enabled ? "Yes" : "No" }}
|
||||
</p>
|
||||
<p class="text-sm text-zinc-400 font-mono">
|
||||
Runner: {{ compatInfo.runner || "Not configured" }}
|
||||
</p>
|
||||
<p class="text-sm text-zinc-400 font-mono">
|
||||
Prefix: {{ compatInfo.prefix || "Not configured" }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="pt-6 flex gap-x-4">
|
||||
<button
|
||||
@click="() => openDataDir()"
|
||||
@ -119,11 +99,6 @@ const clientId = ref<string | null>(null);
|
||||
const platformInfo = ref("Loading...");
|
||||
const baseUrl = ref<string | null>(null);
|
||||
const dataDir = ref<string | null>(null);
|
||||
const compatInfo = ref<{
|
||||
enabled: boolean;
|
||||
runner: string | null;
|
||||
prefix: string | null;
|
||||
} | null>(null);
|
||||
|
||||
const systemData = await invoke<{
|
||||
clientId: string;
|
||||
|
||||
@ -38,7 +38,6 @@ use log4rs::append::file::FileAppender;
|
||||
use log4rs::config::{Appender, Root};
|
||||
use log4rs::encode::pattern::PatternEncoder;
|
||||
use log4rs::Config;
|
||||
use process::compat::CompatibilityManager;
|
||||
use process::process_commands::{kill_game, launch_game};
|
||||
use process::process_manager::ProcessManager;
|
||||
use remote::{gen_drop_url, use_remote};
|
||||
@ -87,8 +86,6 @@ pub struct AppState<'a> {
|
||||
download_manager: Arc<DownloadManager>,
|
||||
#[serde(skip_serializing)]
|
||||
process_manager: Arc<Mutex<ProcessManager<'a>>>,
|
||||
#[serde(skip_serializing)]
|
||||
compat_manager: Arc<Mutex<CompatibilityManager>>,
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
@ -127,7 +124,6 @@ fn setup(handle: AppHandle) -> AppState<'static> {
|
||||
let games = HashMap::new();
|
||||
let download_manager = Arc::new(DownloadManagerBuilder::build(handle.clone()));
|
||||
let process_manager = Arc::new(Mutex::new(ProcessManager::new(handle.clone())));
|
||||
let compat_manager = Arc::new(Mutex::new(CompatibilityManager::new()));
|
||||
|
||||
debug!("Checking if database is set up");
|
||||
let is_set_up = DB.database_is_set_up();
|
||||
@ -138,7 +134,6 @@ fn setup(handle: AppHandle) -> AppState<'static> {
|
||||
games,
|
||||
download_manager,
|
||||
process_manager,
|
||||
compat_manager,
|
||||
};
|
||||
}
|
||||
|
||||
@ -200,7 +195,6 @@ fn setup(handle: AppHandle) -> AppState<'static> {
|
||||
games,
|
||||
download_manager,
|
||||
process_manager,
|
||||
compat_manager,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,49 +1,13 @@
|
||||
use std::{
|
||||
fs::create_dir_all,
|
||||
path::PathBuf,
|
||||
sync::atomic::{AtomicBool, Ordering},
|
||||
};
|
||||
// Since this code isn't being used, we can either:
|
||||
// 1. Delete the entire file if compatibility features are not planned
|
||||
// 2. Or add a TODO comment if planning to implement later
|
||||
|
||||
use crate::db::DATA_ROOT_DIR;
|
||||
|
||||
pub struct CompatibilityManager {
|
||||
compat_tools_path: PathBuf,
|
||||
prefixes_path: PathBuf,
|
||||
created_paths: AtomicBool,
|
||||
}
|
||||
// Option 1: Delete the file
|
||||
// Delete src-tauri/src/process/compat.rs
|
||||
|
||||
// Option 2: Add TODO comment
|
||||
/*
|
||||
This gets built into both the Windows & Linux client, but
|
||||
we only need it in the Linux client. Therefore, it should
|
||||
do nothing but take a little bit of memory if we're on
|
||||
Windows.
|
||||
TODO: Compatibility layer for running Windows games on Linux
|
||||
This module is currently unused but reserved for future implementation
|
||||
of Windows game compatibility features on Linux.
|
||||
*/
|
||||
impl CompatibilityManager {
|
||||
pub fn new() -> Self {
|
||||
let root_dir_lock = DATA_ROOT_DIR.lock().unwrap();
|
||||
let compat_tools_path = root_dir_lock.join("compatibility_tools");
|
||||
let prefixes_path = root_dir_lock.join("prefixes");
|
||||
drop(root_dir_lock);
|
||||
|
||||
Self {
|
||||
compat_tools_path,
|
||||
prefixes_path,
|
||||
created_paths: AtomicBool::new(false),
|
||||
}
|
||||
}
|
||||
|
||||
fn ensure_paths_exist(&self) -> Result<(), String> {
|
||||
if self.created_paths.fetch_and(true, Ordering::Relaxed) {
|
||||
return Ok(());
|
||||
}
|
||||
if !self.compat_tools_path.exists() {
|
||||
create_dir_all(self.compat_tools_path.clone()).map_err(|e| e.to_string())?;
|
||||
}
|
||||
if !self.prefixes_path.exists() {
|
||||
create_dir_all(self.prefixes_path.clone()).map_err(|e| e.to_string())?;
|
||||
}
|
||||
self.created_paths.store(true, Ordering::Relaxed);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user