Add API for propagating cursor locations (#61)

This commit is contained in:
Andras Schmelczer 2025-06-08 20:20:52 +01:00 committed by GitHub
parent f97193e287
commit e8b9bf40c5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
80 changed files with 1930 additions and 2229 deletions

View file

@ -2,7 +2,7 @@ use std::path::Path;
use anyhow::{Context as _, Result};
use database_config::DatabaseConfig;
use log::{info, warn};
use log::info;
use serde::{Deserialize, Serialize};
use server_config::ServerConfig;
use tokio::fs;
@ -24,21 +24,23 @@ pub struct Config {
impl Config {
pub async fn read_or_create(path: &Path) -> Result<Self> {
if path.exists() {
let config = if path.exists() {
info!(
"Loading configuration from '{}'",
path.canonicalize().unwrap().display()
);
Self::load_from_file(path).await
Self::load_from_file(path).await?
} else {
let config = Self::default();
config.write(path).await?;
warn!(
"Configuration file not found, wrote default configuration to '{}'",
path.canonicalize().unwrap().display()
);
Ok(config)
}
Self::default()
};
config.write(path).await?;
info!(
"Updated configuration at '{}'",
path.canonicalize().unwrap().display()
);
Ok(config)
}
pub async fn load_from_file(path: &Path) -> Result<Self> {