improvemets & fixes:
- added 'open with' handling to desktop shortcuts - move logs button to app configuration - fix sync progress disappearing after long hashing - fix sync double file counter - merge wine and proton prefix folders via symlink
This commit is contained in:
parent
8c6db38fab
commit
59ff0b1088
15 changed files with 520 additions and 113 deletions
|
|
@ -57,6 +57,15 @@ function progressGate(emit) {
|
|||
async function treeSize(root) {
|
||||
let files = 0
|
||||
let bytes = 0
|
||||
// a symlink (or a plain file) as the root is the whole tree: walking it
|
||||
// would measure whatever it points at, not what is about to be removed
|
||||
let rootStat = null
|
||||
try {
|
||||
rootStat = await fsp.lstat(root)
|
||||
} catch {
|
||||
return { files, bytes }
|
||||
}
|
||||
if (!rootStat.isDirectory()) return { files: 1, bytes: rootStat.isSymbolicLink() ? 0 : rootStat.size }
|
||||
const walk = async dir => {
|
||||
let entries
|
||||
try {
|
||||
|
|
@ -150,6 +159,24 @@ async function removeTree(root, onProgress) {
|
|||
const tick = () => {
|
||||
if (gate) gate({ files, dirs, bytes }, false)
|
||||
}
|
||||
// A symlink (or a file) as the root is removed as itself, never walked
|
||||
// through: the root of an import/prefix can be a link to another disk, and
|
||||
// deleting through it would take the target's files instead of the link.
|
||||
let rootStat = null
|
||||
try {
|
||||
rootStat = await fsp.lstat(root)
|
||||
} catch {
|
||||
return { files, dirs, bytes }
|
||||
}
|
||||
if (!rootStat.isDirectory()) {
|
||||
files = 1
|
||||
bytes = rootStat.isSymbolicLink() ? 0 : rootStat.size
|
||||
try {
|
||||
await fsp.unlink(root)
|
||||
} catch {}
|
||||
if (gate) gate({ files, dirs, bytes }, true)
|
||||
return { files, dirs, bytes }
|
||||
}
|
||||
const walk = async dir => {
|
||||
let entries
|
||||
try {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue