/** * @file * * @author Max Lammers * @author Mamadou Babaei * * @section LICENSE * * Copyright (c) 2020 - 2023 SenseGlove * * @section DESCRIPTION * * File Input/output handling */ #pragma once #include #include #include "Platform.hpp" namespace SGCore { namespace Util { class SGCORE_API FileIO; }// namespace Util }// namespace SGCore class SGCORE_API SGCore::Util::FileIO { public: /// Attempt to read all lines from a file and place them in the string[]. Returns true if successful. If unable to open the file, the string[] will be empty. /// /// /// static bool ReadTextFile(const std::string& filePath, std::vector& out_lines); /// Attempt to save a string[] to a filename within a desired directory. Returns true if successful. /// Directory is added as a separate variable so we can more easily check for its existence. /// /// /// /// /// static bool SaveTextFile(const std::string& directory, const std::string& fileName, const std::vector& contents, bool bAppend = false); /// Creates a new directory. Returns false if it already existed. /// /// static bool CreateFullDirectory(const std::string& directoryPath); /// Returns true if the directory exists /// /// #if !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) [[nodiscard]] #endif /* !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) */ static bool DirectoryExists(const std::string& directoryPath); /// Returns true if this file exists /// /// static bool FileExists(const std::string& filePath); /// STUB - Gets the working directory of the current process. /// #if !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) [[nodiscard]] #endif /* !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) */ static std::string GetWorkingDirectory(); /// Get the Path to MyDocuments, but without '\\' at the nnd /// #if !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) [[nodiscard]] #endif /* !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) */ static std::string GetMyDocumentsPath(); public: FileIO() = delete; virtual ~FileIO() = delete; };