mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
🎨 Improve exporting data disk check for desktop-end https://github.com/siyuan-note/siyuan/issues/12473
This commit is contained in:
parent
07553bbc35
commit
74d3302b09
8 changed files with 43 additions and 6 deletions
|
|
@ -33,3 +33,12 @@ func NeedWarnDiskUsage(dataSize int64) bool {
|
|||
logging.LogInfof("disk usage [total=%s, used=%s, free=%s]", humanize.BytesCustomCeil(usage.Total, 2), humanize.BytesCustomCeil(usage.Used, 2), humanize.BytesCustomCeil(usage.Free, 2))
|
||||
return usage.Free < uint64(dataSize*2)
|
||||
}
|
||||
|
||||
func GetDiskUsage(p string) (total, used, free uint64) {
|
||||
usage, err := disk.Usage(p)
|
||||
if err != nil {
|
||||
logging.LogErrorf("get disk usage failed: %s", err)
|
||||
return
|
||||
}
|
||||
return usage.Total, usage.Used, usage.Free
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue