CH-J ToolsSerververwaltung über SSH
Menü
Veröffentlichte Quellen

CH-J Tools

Durchsuchen Sie Verzeichnisse und Dateien einer bestimmten Anwendungsausgabe.

Quellen als ZIP herunterladen
CH-J / Server Manager 872 Dateien
core-20261030T220507Z-61e4558d889f Hinzugefügt: · Erstellt:
paths.rs Hinzugefügt: Datum nicht erfasst 2,1 KB · 62 Zeilen
Code Datei herunterladen
1//! Data and resource locations.
2//!
3//! 0.1.1 deliberately keeps the Electron 0.1.0 user-data directory
4//! (`app.setName("CH-J Server Manager")` → `app.getPath("userData")`):
5//! * macOS: ~/Library/Application Support/CH-J Server Manager
6//! * Windows: %APPDATA%\CH-J Server Manager
7//! * Linux: $XDG_CONFIG_HOME/CH-J Server Manager (default ~/.config/…)
8//!
9//! so the existing vault, profiles, settings, modules and history are used in place.
11use std::path::{Path, PathBuf};
13pub const APP_DIRECTORY_NAME: &str = "CH-J Server Manager";
14/// Test/smoke override (absolute path only), same variable name as in 0.1.0 plus a neutral alias.
15pub const USER_DATA_OVERRIDE_VARS: [&str; 2] = ["CHJ_USER_DATA_DIR", "CHJ_BUILD_SMOKE_USER_DATA_DIR"];
17#[derive(Clone, Debug)]
18pub struct AppPaths {
19 /// User data root (identical to Electron 0.1.0 `userData`).
20 pub data: PathBuf,
21 /// Bundled resources (licenses, docs, remote scripts, native helpers, modules).
22 pub resources: PathBuf,
25impl AppPaths {
26 pub fn resolve(config_dir: Option<PathBuf>, resources: PathBuf) -> Result<Self, String> {
27 for var in USER_DATA_OVERRIDE_VARS {
28 if let Ok(value) = std::env::var(var) {
29 let path = PathBuf::from(value);
30 if path.is_absolute() {
31 return Ok(Self { data: path, resources });
32 }
33 }
34 }
35 let base = config_dir.ok_or("The user configuration directory is unavailable.")?;
36 Ok(Self { data: base.join(APP_DIRECTORY_NAME), resources })
37 }
39 pub fn remote_script(&self, name: &str) -> PathBuf {
40 self.resources.join("remote").join(name)
41 }
43 pub fn docs(&self) -> PathBuf {
44 self.resources.join("docs")
45 }
47 pub fn licenses(&self) -> PathBuf {
48 self.resources.join("licenses")
49 }
51 pub fn bundled_modules(&self) -> PathBuf {
52 self.resources.join("modules")
53 }
55 pub fn module_webview_data(&self, module_id: &str) -> PathBuf {
56 self.data.join("webview").join("modules").join(module_id)
57 }
59 pub fn in_data(&self, relative: impl AsRef<Path>) -> PathBuf {
60 self.data.join(relative)
61 }
SHA-256c13324ec61c9fc34c3e31092c231663562b95fea1efb49a38b89a5ca16bd75f2

CH-J Proprietary Software License 1.14 · Die Quellen werden unter der CH-J Proprietary Software License 1.14 bereitgestellt. Ihre Verfügbarkeit ändert die Lizenzbedingungen nicht und gewährt keine zusätzlichen Rechte.

SHA-256 des Archivs77380d4805485ffa4027fbe7858b5836f197a4aa9d52358a43e2d12d018744df
Dateien