Skip to content

Commit 1042543

Browse files
Fix: 起動直後は辞書が反映されないのを修正
1 parent fbd9690 commit 1042543

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/main.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ mod voicevox;
99

1010
use crate::aivoice::AIVOICE;
1111
use crate::icon_manager::ICON_MANAGER;
12+
use crate::routes::audio_query::OPEN_JTALK;
13+
use crate::routes::user_dict::USER_DICT;
1214

1315
use anyhow::Result;
1416
use axum::{
@@ -121,6 +123,11 @@ async fn main_impl(args: Cli) -> Result<()> {
121123

122124
info!("Starting server...");
123125

126+
{
127+
let open_jtalk = OPEN_JTALK.lock().await;
128+
let user_dict = USER_DICT.lock().await;
129+
open_jtalk.use_user_dict(&user_dict)?;
130+
}
124131
info!("Listening on port {}", port);
125132

126133
axum::Server::bind(&addr)

src/routes/user_dict.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use tracing::warn;
1111

1212
use crate::error::{Error, Result};
1313

14-
static USER_DICT: Lazy<Arc<Mutex<UserDict>>> = Lazy::new(|| {
14+
pub static USER_DICT: Lazy<Arc<Mutex<UserDict>>> = Lazy::new(|| {
1515
let mut user_dict = UserDict::new();
1616

1717
if std::fs::metadata(&*USER_DICT_PATH).is_ok() {
@@ -21,7 +21,7 @@ static USER_DICT: Lazy<Arc<Mutex<UserDict>>> = Lazy::new(|| {
2121
Arc::new(Mutex::new(user_dict))
2222
});
2323

24-
static USER_DICT_PATH: Lazy<String> = Lazy::new(|| {
24+
pub static USER_DICT_PATH: Lazy<String> = Lazy::new(|| {
2525
process_path::get_executable_path()
2626
.unwrap()
2727
.parent()

0 commit comments

Comments
 (0)