From d01f7641234150d32fb679b9bde4bb4fe6221e91 Mon Sep 17 00:00:00 2001 From: purocean Date: Mon, 7 Jun 2021 16:54:33 +0800 Subject: [PATCH] =?UTF-8?q?upd:=20=E5=BC=83=E7=94=A8=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E4=BB=93=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/server/constant.ts | 1 - src/server/init.ts | 5 +---- src/server/repository.ts | 9 ++++----- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/server/constant.ts b/src/server/constant.ts index 1ea76a25..506ad38f 100644 --- a/src/server/constant.ts +++ b/src/server/constant.ts @@ -9,7 +9,6 @@ const homedir = isWsl ? toWslPath(getWinHomePath()) : os.homedir() export const HOME_DIR = homedir export const USER_DIR = path.resolve((yargs.argv['data-dir'] as any) || path.join(homedir, 'yank-note')) export const TRASH_DIR = path.join(USER_DIR, 'trash') -export const MAIN_REPO_DIR = path.join(USER_DIR, 'main') export const CONFIG_FILE = path.join(USER_DIR, 'config.json') export const STATIC_DIR = path.join(__dirname, '../../frontend/dist') export const HELP_DIR = path.join(__dirname, '../../help') diff --git a/src/server/init.ts b/src/server/init.ts index b10b7cdd..6220c066 100644 --- a/src/server/init.ts +++ b/src/server/init.ts @@ -1,14 +1,11 @@ import * as fs from 'fs' import * as path from 'path' -import { USER_DIR, TRASH_DIR, MAIN_REPO_DIR, USER_PLUGIN_DIR } from './constant' +import { USER_DIR, TRASH_DIR, USER_PLUGIN_DIR } from './constant' const init = () => { if (!fs.existsSync(USER_DIR)) { fs.mkdirSync(USER_DIR) } - if (!fs.existsSync(MAIN_REPO_DIR)) { - fs.mkdirSync(MAIN_REPO_DIR) - } if (!fs.existsSync(TRASH_DIR)) { fs.mkdirSync(TRASH_DIR) } diff --git a/src/server/repository.ts b/src/server/repository.ts index 1df1f1c0..41cbb9fc 100644 --- a/src/server/repository.ts +++ b/src/server/repository.ts @@ -1,12 +1,11 @@ import * as path from 'path' import config from './config' -import { MAIN_REPO_DIR, TRASH_DIR } from './constant' -import { isWsl, toWslPath, toWinPath } from './wsl' +import { TRASH_DIR } from './constant' +import { isWsl, toWslPath } from './wsl' const configKey = 'repositories' -// windows 上不管是不是 wsl 环境都使用 windows 风格的路径配置 -const defaultVal = { main: isWsl ? toWinPath(MAIN_REPO_DIR) : MAIN_REPO_DIR } +const defaultVal = {} const list = () => { return config.get(configKey, defaultVal) @@ -21,7 +20,7 @@ const getPath = (name: string) => { } if (isWsl) { - return /^[a-zA-Z]:/.test(p) ? toWslPath(p) : path.join(MAIN_REPO_DIR, p) + p = /^[a-zA-Z]:/.test(p) ? toWslPath(p) : p } return path.isAbsolute(p) ? p : path.resolve(p)