Skip to content

Commit

Permalink
Fixing bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
CasualYT31 committed Jul 14, 2021
1 parent 732476e commit 46cf88f
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions SystemProperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ SOFTWARE.*/

#include "SystemProperties.hpp"
#include <fstream>
#include <iostream>

std::uint64_t sys::convert(const std::uint64_t bytes, const sys::unit unit) {
switch (unit) {
Expand Down Expand Up @@ -201,9 +200,8 @@ std::string sys::storage::capacity(const sys::unit unit) {
std::ifstream ifs(tempfile);
std::string ret;
// skip first three lines, read fourth line
for (int x = 0; x < 4; x++) std::getline(ifs, ret);
std::cout << ret << std::endl;
std::uint64_t count = std::stoll(ret);
for (int x = 0; x < 3; x++) std::getline(ifs, ret);
std::uint64_t count = std::stoll(getcleanline(ifs));
ifs.close();
remove(tempfile.c_str());
cache = std::to_string(sys::convert(count, unit)) + sys::notation(unit);
Expand All @@ -218,8 +216,8 @@ std::string sys::storage::free(const sys::unit unit) {
std::ifstream ifs(tempfile);
std::string ret;
// skip first three lines, read fourth line
for (int x = 0; x < 4; x++) std::getline(ifs, ret);
std::uint64_t count = std::stoll(ret);
for (int x = 0; x < 3; x++) std::getline(ifs, ret);
std::uint64_t count = std::stoll(getcleanline(ifs));
ifs.close();
remove(tempfile.c_str());
cache = std::to_string(sys::convert(count, unit)) + sys::notation(unit);
Expand Down

0 comments on commit 46cf88f

Please sign in to comment.