Skip to content

Commit

Permalink
check if empty
Browse files Browse the repository at this point in the history
  • Loading branch information
dnzbk committed Aug 30, 2024
1 parent 9add6ac commit 56cbce5
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 12 deletions.
36 changes: 26 additions & 10 deletions daemon/remote/XmlRpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1462,20 +1462,36 @@ void StatusXmlCommand::Execute()
int64 freeInterDiskSpace = 0;
int64 totalInterDiskSpace = 0;

auto destDirRes = FileSystem::GetDiskState(g_Options->GetDestDir());
if (destDirRes.has_value())
if (Util::EmptyStr(g_Options->GetDestDir()))
{
const auto& value = destDirRes.value();
freeDiskSpace = value.available;
totalDiskSpace = value.total;
freeDiskSpace = 0;
totalDiskSpace = 0;
}
else
{
auto res = FileSystem::GetDiskState(g_Options->GetDestDir());
if (res.has_value())
{
const auto& value = res.value();
freeDiskSpace = value.available;
totalDiskSpace = value.total;
}
}

auto interDirRes = FileSystem::GetDiskState(g_Options->GetInterDir());
if (interDirRes.has_value())
if (Util::EmptyStr(g_Options->GetInterDir()))
{
const auto& value = interDirRes.value();
freeInterDiskSpace = value.available;
totalInterDiskSpace = value.total;
freeInterDiskSpace = freeDiskSpace;
totalInterDiskSpace = totalDiskSpace;
}
else
{
auto res = FileSystem::GetDiskState(g_Options->GetInterDir());
if (res.has_value())
{
const auto& value = res.value();
freeInterDiskSpace = value.available;
totalInterDiskSpace = value.total;
}
}

Util::SplitInt64(freeDiskSpace, &freeDiskSpaceHi, &freeDiskSpaceLo);
Expand Down
6 changes: 4 additions & 2 deletions webui/system-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,10 @@ var SystemInfo = (new function($)

if (destDirOpt && interDirOpt)
{
renderDiskSpace(+status['FreeDiskSpaceMB'], +status['TotalDiskSpaceMB'], destDirOpt.Value);
renderInterDiskSpace(+status['FreeInterDiskSpaceMB'], +status['TotalInterDiskSpaceMB'], interDirOpt.Value);
var destDirPath = destDirOpt.Value;
var interDistPath = interDirOpt.Value ? interDirOpt : destDirPath;
renderDiskSpace(+status['FreeDiskSpaceMB'], +status['TotalDiskSpaceMB'], destDirPath);
renderInterDiskSpace(+status['FreeInterDiskSpaceMB'], +status['TotalInterDiskSpaceMB'], interDistPath);
}
}
}
Expand Down

0 comments on commit 56cbce5

Please sign in to comment.