mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-12-05 06:22:18 +00:00
fix Linux storage reporting
This commit is contained in:
4 files changed
+306
-32
No files matched your search
@@ -789,37 +789,6 @@ sysinfo_backend_get_memory (void)
|
||||
return memory;
|
||||
}
|
||||
|
||||
char *
|
||||
sysinfo_backend_get_disk (void)
|
||||
{
|
||||
const char *path;
|
||||
struct statvfs fs;
|
||||
guint64 block_size;
|
||||
guint64 total;
|
||||
guint64 available;
|
||||
char *usage;
|
||||
|
||||
/* Flatpak's home itself can be tmpfs; its data directory is persistent
|
||||
* storage on the host filesystem that actually holds the app's data. */
|
||||
path = g_file_test ("/.flatpak-info", G_FILE_TEST_IS_REGULAR)
|
||||
? g_get_user_data_dir () : g_get_home_dir ();
|
||||
if (!path || path[0] == '\0')
|
||||
{
|
||||
path = "/";
|
||||
}
|
||||
|
||||
if (statvfs (path, &fs) != 0)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
block_size = fs.f_frsize != 0 ? (guint64) fs.f_frsize : (guint64) fs.f_bsize;
|
||||
total = (guint64) fs.f_blocks * block_size;
|
||||
available = (guint64) fs.f_bavail * block_size;
|
||||
usage = format_usage (total, available);
|
||||
return usage;
|
||||
}
|
||||
|
||||
char *
|
||||
sysinfo_backend_get_uptime (void)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user