mirror of
https://github.com/Kuingsmile/PicList.git
synced 2025-02-02 11:08:13 -05:00
🔨 Refactor(custom): change default temp dir to system temp dir path
ISSUES CLOSED: #112
This commit is contained in:
parent
e968a65cca
commit
4aae2c3fbe
@ -296,7 +296,6 @@ SETTINGS_TAB_SYNC_CONFIG: Sync and Configuration
|
||||
SETTINGS_TAB_UPLOAD: Upload
|
||||
SETTINGS_TAB_ADVANCED: Advanced
|
||||
SETTINGS_TAB_UPDATE: Update
|
||||
SETTINGS_GENERAL_TEMP_DIR_PATH: Temporary directory path
|
||||
# shortcut-page
|
||||
|
||||
BUILTIN_CLIPBOARD_TIPS: Use builtin clipboard function to upload instead of using scripts
|
||||
|
@ -299,7 +299,6 @@ SETTINGS_TAB_SYNC_CONFIG: 同步与配置
|
||||
SETTINGS_TAB_UPLOAD: 上传设置
|
||||
SETTINGS_TAB_ADVANCED: 高级设置
|
||||
SETTINGS_TAB_UPDATE: 更新
|
||||
SETTINGS_GENERAL_TEMP_DIR_PATH: 临时文件夹路径
|
||||
# shortcut-page
|
||||
|
||||
SHORTCUT_NAME: 快捷键名称
|
||||
|
@ -297,7 +297,6 @@ SETTINGS_TAB_SYNC_CONFIG: 同步與配置
|
||||
SETTINGS_TAB_UPLOAD: 上傳設置
|
||||
SETTINGS_TAB_ADVANCED: 高級設置
|
||||
SETTINGS_TAB_UPDATE: 更新
|
||||
SETTINGS_GENERAL_TEMP_DIR_PATH: 本地暫存路徑
|
||||
# shortcut-page
|
||||
|
||||
SHORTCUT_NAME: 快捷鍵名稱
|
||||
|
@ -67,13 +67,6 @@ export const manageIpcList = {
|
||||
return res
|
||||
})
|
||||
|
||||
ipcMain.handle('openDirectorySelectDialog', async () => {
|
||||
const res = await dialog.showOpenDialog({
|
||||
properties: ['openDirectory']
|
||||
})
|
||||
return res.filePaths[0]
|
||||
})
|
||||
|
||||
ipcMain.handle('openFileSelectDialog', async () => {
|
||||
const res = await dialog.showOpenDialog({
|
||||
properties: ['openFile', 'multiSelections']
|
||||
|
@ -49,14 +49,7 @@ export function isInputConfigValid (config: any): boolean {
|
||||
export const getFileMimeType = (filePath: string): string => mime.lookup(filePath) || 'application/octet-stream'
|
||||
|
||||
const getTempDirPath = () => {
|
||||
const defaultPath = path.join(app.getPath('downloads'), 'piclistTemp')
|
||||
try {
|
||||
const configFilePath = path.join(app.getPath('userData'), 'data.json')
|
||||
const { settings: { tempDirPath = '' } = {} } = fs.readJSONSync(configFilePath) || {}
|
||||
return tempDirPath ? path.join(tempDirPath, 'piclistTemp') : defaultPath
|
||||
} catch (e) {
|
||||
return defaultPath
|
||||
}
|
||||
return path.join(app.getPath('temp'), 'piclistTemp')
|
||||
}
|
||||
|
||||
const checkTempFolderExist = async (tempPath: string) => {
|
||||
|
@ -194,18 +194,6 @@
|
||||
{{ $T('SETTINGS_CLICK_TO_SET') }}
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
:label="$T('SETTINGS_GENERAL_TEMP_DIR_PATH')"
|
||||
>
|
||||
<el-button
|
||||
type="primary"
|
||||
round
|
||||
size="small"
|
||||
@click="handleTempDirPath"
|
||||
>
|
||||
{{ $T('SETTINGS_CLICK_TO_SET') }}
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-row>
|
||||
</el-col>
|
||||
@ -1737,8 +1725,7 @@ const form = reactive<ISettingForm>({
|
||||
yourlsSignature: '',
|
||||
deleteLocalFile: false,
|
||||
serverKey: '',
|
||||
aesPassword: '',
|
||||
tempDirPath: ''
|
||||
aesPassword: ''
|
||||
})
|
||||
|
||||
const languageList = i18nManager.languageList.map(item => ({
|
||||
@ -1903,7 +1890,6 @@ async function initData () {
|
||||
form.deleteLocalFile = settings.deleteLocalFile || false
|
||||
form.serverKey = settings.serverKey || ''
|
||||
form.aesPassword = settings.aesPassword || 'PicList-aesPassword'
|
||||
form.tempDirPath = settings.tempDirPath || ''
|
||||
currentLanguage.value = settings.language ?? 'zh-CN'
|
||||
currentStartMode.value = settings.startMode || 'quiet'
|
||||
customLink.value = settings.customLink || '![$fileName]($url)'
|
||||
@ -2209,15 +2195,6 @@ function handleMiniWindowOntop (val: ICheckBoxValueType) {
|
||||
$message.info($T('TIPS_NEED_RELOAD'))
|
||||
}
|
||||
|
||||
async function handleTempDirPath (evt: Event) {
|
||||
const result = await invokeToMain('openDirectorySelectDialog')
|
||||
if (result) {
|
||||
form.tempDirPath = result
|
||||
saveConfig('settings.tempDirPath', form.tempDirPath)
|
||||
$message.info($T('TIPS_NEED_RELOAD'))
|
||||
}
|
||||
}
|
||||
|
||||
async function handleMiniIconPath (evt: Event) {
|
||||
const result = await invokeToMain('openFileSelectDialog')
|
||||
if (result && result[0]) {
|
||||
|
1
src/universal/types/i18n.d.ts
vendored
1
src/universal/types/i18n.d.ts
vendored
@ -292,7 +292,6 @@ interface ILocales {
|
||||
SETTINGS_TAB_UPLOAD: string
|
||||
SETTINGS_TAB_ADVANCED: string
|
||||
SETTINGS_TAB_UPDATE: string
|
||||
SETTINGS_GENERAL_TEMP_DIR_PATH: string
|
||||
SHORTCUT_NAME: string
|
||||
SHORTCUT_BIND: string
|
||||
SHORTCUT_STATUS: string
|
||||
|
1
src/universal/types/view.d.ts
vendored
1
src/universal/types/view.d.ts
vendored
@ -30,7 +30,6 @@ interface ISettingForm {
|
||||
deleteLocalFile: boolean,
|
||||
serverKey: string,
|
||||
aesPassword: string,
|
||||
tempDirPath: string,
|
||||
}
|
||||
|
||||
interface IShortKeyMap {
|
||||
|
Loading…
Reference in New Issue
Block a user