This commit is contained in:
parent
891a435ff0
commit
c341100d5d
|
|
@ -284,21 +284,13 @@ const SharedFilesModel = forwardRef((props: any, ref: any) => {
|
||||||
const buffer = Buffer.from(arrayBuffer);
|
const buffer = Buffer.from(arrayBuffer);
|
||||||
fs.writeFile(`${setting.shareFilesPath}${fileItem[fileIndex].fileName}`, buffer, {});
|
fs.writeFile(`${setting.shareFilesPath}${fileItem[fileIndex].fileName}`, buffer, {});
|
||||||
message.success(`下载成功!文件已保存至:${setting.shareFilesPath}`)
|
message.success(`下载成功!文件已保存至:${setting.shareFilesPath}`)
|
||||||
try {
|
await fs.access(setting.shareFilesPath, fs.constants.F_OK);
|
||||||
await fs.access(setting.shareFilesPath, fs.constants.F_OK);
|
if (process.platform === 'win32') {
|
||||||
if (process.platform === 'win32') {
|
exec(`explorer "${setting.shareFilesPath}"`);
|
||||||
exec(`explorer "${setting.shareFilesPath}"`);
|
} else if (process.platform === 'darwin') {
|
||||||
} else if (process.platform === 'darwin') {
|
exec(`open "${setting.shareFilesPath}"`);
|
||||||
exec(`open "${setting.shareFilesPath}"`);
|
|
||||||
}
|
|
||||||
getRoomFile()
|
|
||||||
} catch (error: any) {
|
|
||||||
if (error.code === 'ENOENT') {
|
|
||||||
message.error('文件夹不存在!')
|
|
||||||
} else {
|
|
||||||
message.error(error)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
getRoomFile()
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
if (error.code === 'ENOENT') {
|
if (error.code === 'ENOENT') {
|
||||||
message.error('文件夹不存在!')
|
message.error('文件夹不存在!')
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue