🎨 使用第三方同步盘时弹出提示并退出内核 https://github.com/siyuan-note/siyuan/issues/7683

This commit is contained in:
Liang Ding 2023-03-17 11:08:16 +08:00
parent df3ee3f24e
commit f2f60cf9fe
No known key found for this signature in database
GPG key ID: 136F30F901A2231D

View file

@ -355,6 +355,11 @@
const {ipcRenderer} = require('electron')
const fs = require('fs')
const initPath = result.filePaths[0]
if (isCloudDrivePath(initPath)) {
alert('⚠️ This folder may be a cloud sync disk folder, please change to a local folder')
return
}
if (!fs.existsSync(initPath)) {
fs.mkdirSync(initPath, {mode: 0o755, recursive: true})
}
@ -366,6 +371,12 @@
})
})
})
const isCloudDrivePath = (absPath) => {
const absPathLower = absPath.toLowerCase()
return -1 < absPathLower.indexOf("onedrive") || -1 < absPathLower.indexOf("dropbox") ||
-1 < absPathLower.indexOf("google drive") || -1 < absPathLower.indexOf("pcloud")
}
</script>
</body>
</html>