-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show disk free space when restoring PIXLISE backup. Also ensure datas…
…et optimiser doesn't optimise when there is only one zip file
- Loading branch information
Peter Nemere
committed
Nov 7, 2024
1 parent
5a8c40d
commit 311c404
Showing
7 changed files
with
55 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
//go:build !windows | ||
|
||
package utils | ||
|
||
import ( | ||
"os" | ||
|
||
"golang.org/x/sys/unix" | ||
) | ||
|
||
func GetDiskAvailableBytes() (uint64, error) { | ||
var stat unix.Statfs_t | ||
wd, err := os.Getwd() | ||
if err != nil { | ||
return 0, err | ||
} | ||
|
||
unix.Statfs(wd, &stat) | ||
|
||
// Available blocks * size per block = available space in bytes | ||
return stat.Bavail * uint64(stat.Bsize), nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package utils | ||
|
||
import "golang.org/x/sys/windows" | ||
|
||
func GetDiskAvailableBytes() (uint64, error) { | ||
var freeBytesAvailable uint64 | ||
var totalNumberOfBytes uint64 | ||
var totalNumberOfFreeBytes uint64 | ||
|
||
err := windows.GetDiskFreeSpaceEx(windows.StringToUTF16Ptr("C:"), | ||
&freeBytesAvailable, &totalNumberOfBytes, &totalNumberOfFreeBytes) | ||
if err != nil { | ||
return 0, err | ||
} | ||
return freeBytesAvailable, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters