Skip to content

Commit

Permalink
fix: 首次打开时配置文件夹不存在
Browse files Browse the repository at this point in the history
  • Loading branch information
orangelckc committed Jan 25, 2023
1 parent 2584e53 commit b2a4978
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 10 deletions.
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<link rel="icon" type="image/svg+xml" href="#" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>哔哩哔哩直播助手</title>
<title>哔哩哔哩-直播间管家机器人</title>
</head>

<body>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "bili-bot",
"private": true,
"version": "1.2.1",
"version": "1.2.2",
"type": "module",
"scripts": {
"dev": "npm run build:icon & vite",
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "bili-bot"
version = "1.2.1"
description = "哔哩哔哩直播间弹幕机器人"
version = "1.2.2"
description = "哔哩哔哩-直播间管家机器人"
authors = ["半糖人类"]
license = "MIT"
repository = "https://github.com/orangelckc/bili-bot"
Expand Down
4 changes: 2 additions & 2 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ fn main() {
fix_path_env::fix().expect("修复macOS环境变量失败");

tauri::Builder::default()
.setup(|app| {
.setup(|_app| {
#[cfg(target_os = "macos")] //✅ `macOS`下不显示docker图标
app.set_activation_policy(tauri::ActivationPolicy::Accessory);
_app.set_activation_policy(tauri::ActivationPolicy::Accessory);
Ok(())
})
.plugin(tauri_plugin_store::Builder::default().build())
Expand Down
6 changes: 5 additions & 1 deletion src/constants/store.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import { version } from '../../package.json'
import { configDir } from '@tauri-apps/api/path'
import { readDir, createDir } from "@tauri-apps/api/fs";

const STORE_DEFAULT_VALUES: Record<string, any> = {
version
};
// 本地配置文件路径
const STORE_DEFAULT_PATH = await configDir() + 'bili-bot';

// 首次打开时创建配置文件夹
await readDir(STORE_DEFAULT_PATH).catch(async () => {
await createDir(STORE_DEFAULT_PATH);
});
export { STORE_DEFAULT_VALUES, STORE_DEFAULT_PATH };
2 changes: 1 addition & 1 deletion src/views/Login/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const logout = () => {
};
const validateLoginInfo = async () => {
if (!isLogin) return
if (!await isLogin()) return
const result = await validateLoginInfoApi();
if (result.code) {
Expand Down

0 comments on commit b2a4978

Please sign in to comment.