Browse Source

:art: Improve workspace main menu name

Daniel 9 months ago
parent
commit
052288f57c
1 changed files with 2 additions and 1 deletions
  1. 2 1
      app/src/util/noRelyPCFunction.ts

+ 2 - 1
app/src/util/noRelyPCFunction.ts

@@ -2,6 +2,7 @@ import {Dialog} from "../dialog";
 import {fetchPost} from "./fetch";
 import {fetchPost} from "./fetch";
 import {isMobile} from "./functions";
 import {isMobile} from "./functions";
 import {Constants} from "../constants";
 import {Constants} from "../constants";
+import {pathPosix} from "./pathName";
 
 
 // 需独立出来,否则移动端引用的时候会引入 pc 端大量无用代码
 // 需独立出来,否则移动端引用的时候会引入 pc 端大量无用代码
 export const renameTag = (labelName: string) => {
 export const renameTag = (labelName: string) => {
@@ -31,7 +32,7 @@ export const renameTag = (labelName: string) => {
 };
 };
 
 
 export const getWorkspaceName = () => {
 export const getWorkspaceName = () => {
-    return window.siyuan.config.system.workspaceDir.replace(/^.*[\\\/]/, "");
+    return pathPosix().basename(window.siyuan.config.system.workspaceDir.replace(/\\/g, "/"));
 };
 };
 
 
 export const checkFold = (id: string, cb: (zoomIn: boolean, action: string[], isRoot: boolean) => void) => {
 export const checkFold = (id: string, cb: (zoomIn: boolean, action: string[], isRoot: boolean) => void) => {