~aleteoryx/muditaos

d16947c8b7571482341565d677a58bc4739b4739 — Wiktor S. Ovalle Correa 5 years ago fe72169
[EGD-5737] Fix compilation issues after merge

Master was using some fetures removed by new filesystem
M module-apps/application-onboarding/model/EULARepository.cpp => module-apps/application-onboarding/model/EULARepository.cpp +10 -8
@@ 3,9 3,10 @@

#include <module-utils/gsl/gsl_util>
#include "module-utils/i18n/i18n.hpp"
#include "module-utils/Utils.hpp"

#include "EULARepository.hpp"
#include <fstream>
#include <sstream>

namespace app::onBoarding
{


@@ 16,18 17,19 @@ namespace app::onBoarding
    std::string EULARepository::getEulaText()
    {
        auto displayLanguageName = utils::localize.getDisplayLanguage();
        auto eulaFile            = utils::filesystem::openFile(licensesPath / displayLanguageName / fileName);
        auto fileHandlerCleanup  = gsl::finally([&eulaFile]() { utils::filesystem::closeFile(eulaFile); });
        auto eulaFile            = std::ifstream(licensesPath / displayLanguageName / fileName);
        auto fileHandlerCleanup  = gsl::finally([&eulaFile]() { eulaFile.close(); });

        if (eulaFile == nullptr) {
            eulaFile = utils::filesystem::openFile(licensesPath / utils::i18n::DefaultLanguage / fileName);
        if (!eulaFile.is_open()) {
            eulaFile.open(licensesPath / utils::i18n::DefaultLanguage / fileName);

            if (eulaFile == nullptr) {
            if (!eulaFile.is_open()) {
                throw std::runtime_error("EULA assets missing in system!");
            }
        }
        auto eulaText = utils::filesystem::readFile(eulaFile);
        std::ostringstream eulaText;
        eulaText << eulaFile.rdbuf();

        return eulaText;
        return eulaText.str();
    }
} // namespace app::onBoarding

M module-bsp/board/rt1051/bsp/watchdog/watchdog.cpp => module-bsp/board/rt1051/bsp/watchdog/watchdog.cpp +1 -1
@@ 20,7 20,7 @@ namespace bsp::watchdog
            return false;
        }

        rtwdog_config_t config      = {0};
        rtwdog_config_t config      = {};
        config.enableRtwdog         = true;
        config.clockSource          = kRTWDOG_ClockSource1;            // LPO_CLK clock (32.768kHz)
        config.prescaler            = kRTWDOG_ClockPrescalerDivide256; // 256 prescaler (effectively 128Hz clock)

M module-services/service-desktop/endpoints/backup/BackupRestore.cpp => module-services/service-desktop/endpoints/backup/BackupRestore.cpp +0 -1
@@ 17,7 17,6 @@
#include <memory>
#include <string>
#include <vector>
#include <vfs.hpp>

namespace sys
{

M module-services/service-desktop/endpoints/deviceInfo/DeviceInfoEndpoint.cpp => module-services/service-desktop/endpoints/deviceInfo/DeviceInfoEndpoint.cpp +2 -1
@@ 14,7 14,8 @@

#include <cstdint>
#include <string>
#include <vfs.hpp>
#include <sys/statvfs.h>
#include <purefs/filesystem_paths.hpp>

using namespace parserFSM;


M module-services/service-desktop/endpoints/update/UpdateMuditaOS.hpp => module-services/service-desktop/endpoints/update/UpdateMuditaOS.hpp +1 -1
@@ 13,7 13,7 @@
#include <iosfwd>
#include <string>
#include <vector>
#include <vfs.hpp>
#include <atomic>

class ServiceDesktop;
namespace fs = std::filesystem;

M module-utils/Utils.cpp => module-utils/Utils.cpp +1 -21
@@ 2,7 2,7 @@
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "Utils.hpp"
#include <purefs/fs/filesystem.hpp>
#include <filesystem>
#include <crc32/crc32.h>

namespace utils::filesystem


@@ 72,26 72,6 @@ namespace utils::filesystem
        return ret;
    }

    std::FILE *openFile(const std::filesystem::path &filePath) noexcept
    {
        return std::fopen(filePath.c_str(), "r");
    }

    std::string readFile(std::FILE *file) noexcept
    {
        uint32_t fsize = utils::filesystem::filelength(file);
        auto stream    = std::make_unique<char[]>(fsize + 1);
        std::fread(stream.get(), 1, fsize, file);

        return stream.get();
    }

    void closeFile(std::FILE *file) noexcept
    {
        if (file != nullptr) {
            std::fclose(file);
        }
    }
} // namespace utils::filesystem

namespace utils

M module-utils/Utils.hpp => module-utils/Utils.hpp +0 -3
@@ 264,8 264,5 @@ namespace utils
        [[nodiscard]] unsigned long computeFileCRC32(std::FILE *file) noexcept;
        [[nodiscard]] std::string generateRandomId(std::size_t length = 0) noexcept;
        [[nodiscard]] std::string getline(std::FILE *stream, uint32_t length = 1024) noexcept;
        [[nodiscard]] std::FILE *openFile(const std::filesystem::path &filePath) noexcept;
        [[nodiscard]] std::string readFile(std::FILE *file) noexcept;
        void closeFile(std::FILE *file) noexcept;
    } // namespace filesystem
} // namespace utils

M source/main.cpp => source/main.cpp +1 -0
@@ 72,6 72,7 @@ int main()

    bsp::BoardInit();

    purefs::subsystem::vfs_handle_t vfs;
    if (!sys::SystemWatchdog::getInstance().init()) {
        LOG_ERROR("System watchdog failed to initialize");
        // wait for the hardware watchdog (initialized in reset ISR) to reset the system