GPS refactored (#262)
- Refactored GPS service and HAL: GPS is no longer part of the HAL configuration. You can now add configure new GPS devices from the GPS settings app. - T-Deck adds a boot hook to check if a GPS configuration exists and adds it when the config is empty. - Implemented the concept of ObjectFile to read/write arrays of a raw data type (e.g. struct) to disk. - Implemented more file utils (e.g. to create all directories of a path)
This commit is contained in:
committed by
GitHub
parent
81ece6f2e7
commit
d0ca3b16f8
@@ -3,9 +3,24 @@
|
||||
#include "Tactility/TactilityCore.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <sys/stat.h>
|
||||
|
||||
namespace tt::file {
|
||||
|
||||
#ifdef _WIN32
|
||||
constexpr char SEPARATOR = '\\';
|
||||
#else
|
||||
constexpr char SEPARATOR = '/';
|
||||
#endif
|
||||
|
||||
struct FileCloser {
|
||||
void operator()(FILE* file) {
|
||||
if (file != nullptr) {
|
||||
fclose(file);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
long getSize(FILE* file);
|
||||
|
||||
/** Read a file and return its data.
|
||||
@@ -21,4 +36,11 @@ std::unique_ptr<uint8_t[]> readBinary(const std::string& filepath, size_t& outSi
|
||||
*/
|
||||
std::unique_ptr<uint8_t[]> readString(const std::string& filepath);
|
||||
|
||||
/** Ensure a directory path exists.
|
||||
* @param[in] path the directory path to find, or to create recursively
|
||||
* @param[in] mode the mode to use when creating directories
|
||||
* @return true when the specified path was found, or otherwise creates the directories recursively with the specified mode.
|
||||
*/
|
||||
bool findOrCreateDirectory(std::string path, mode_t mode);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user