diff --git a/src_main/system/pisysteminfo.cpp b/src_main/system/pisysteminfo.cpp index bdb07eff..7130cf7a 100644 --- a/src_main/system/pisysteminfo.cpp +++ b/src_main/system/pisysteminfo.cpp @@ -29,6 +29,16 @@ #define SALT_SIZE 8 + + +PISystemInfo::MountInfo::MountInfo() { + space_all = space_used = space_free = 0; + removable = false; +} + + + + PISystemInfo::PISystemInfo() { processorsCount = 1; } @@ -79,12 +89,14 @@ PIStringList PISystemInfo::mountRoots() { struct String3 {PIString mp, type, label;}; -PIVector PISystemInfo::mountInfo() { +PIVector PISystemInfo::mountInfo(bool ignore_cache) { static PIVector cache; static PITimeMeasurer tm; static bool first = true; - if (tm.elapsed_m() < piMountInfoRefreshIntervalMs && !first) - return cache; + if (!ignore_cache) { + if (tm.elapsed_m() < piMountInfoRefreshIntervalMs && !first) + return cache; + } first = false; tm.reset(); cache.clear(); @@ -109,6 +121,8 @@ PIVector PISystemInfo::mountInfo() { m.space_used = m.space_all - m.space_free; } else m.space_all = m.space_free = m.space_used = 0U; + if (GetDriveType(clet.dataAscii()) == DRIVE_REMOVABLE) + m.removable = true; clet.cutRight(1); int qdd = QueryDosDevice(clet.data(), volfs, 1023); if (qdd > 0) diff --git a/src_main/system/pisysteminfo.h b/src_main/system/pisysteminfo.h index a2490a7f..5cab4fc4 100644 --- a/src_main/system/pisysteminfo.h +++ b/src_main/system/pisysteminfo.h @@ -27,7 +27,7 @@ public: PISystemInfo(); struct MountInfo { - MountInfo() {space_all = space_used = space_free = 0;} + MountInfo(); PIString mount_point; PIString device; PIString filesystem; @@ -35,6 +35,7 @@ public: ullong space_all; ullong space_used; ullong space_free; + bool removable; }; PIString ifconfigPath, execCommand, hostname, user, OS_name, OS_version, architecture; @@ -42,7 +43,7 @@ public: int processorsCount; static PIStringList mountRoots(); - static PIVector mountInfo(); + static PIVector mountInfo(bool ignore_cache = false); static PIString machineKey(); static uint machineID();