YourGameLib
Loading...
Searching...
No Matches
file.h
Go to the documentation of this file.
1/*
2Copyright (c) 2019-2024 Alexander Scholz
3
4This software is provided 'as-is', without any express or implied
5warranty. In no event will the authors be held liable for any damages
6arising from the use of this software.
7
8Permission is granted to anyone to use this software for any purpose,
9including commercial applications, and to alter it and redistribute it
10freely, subject to the following restrictions:
11
121. The origin of this software must not be misrepresented; you must not
13 claim that you wrote the original software. If you use this software
14 in a product, an acknowledgment in the product documentation would be
15 appreciated but is not required.
162. Altered source versions must be plainly marked as such, and must not be
17 misrepresented as being the original software.
183. This notice may not be removed or altered from any source distribution.
19*/
20#ifndef YOURGAME_INTERNAL_FILE_H
21#define YOURGAME_INTERNAL_FILE_H
22
23#include <cstdint>
24#include <vector>
25#include <string>
26
28{
29 namespace file
30 {
31 const std::string ARCHIVE_FILE_EXTENSION = "zip";
32
33 int readFileFromPath(const std::string &filepath, std::vector<uint8_t> &dst);
34
35 int readFileFromArchive(const std::string &archivepath, const std::string &filename, std::vector<uint8_t> &dst);
36
37 int writeFileToPath(const std::string &filepath, const void *data, size_t numBytes);
38
39 bool checkIfPathIsDirectory(const std::string &filepath);
40
41 void normalizePath(std::string &path);
42 } // namespace file
43} // namespace yourgame_internal
44
45#endif
int readFileFromArchive(const std::string &archivepath, const std::string &filename, std::vector< uint8_t > &dst)
Definition file.cpp:54
int writeFileToPath(const std::string &filepath, const void *data, size_t numBytes)
Definition file.cpp:83
int readFileFromPath(const std::string &filepath, std::vector< uint8_t > &dst)
Definition file.cpp:35
bool checkIfPathIsDirectory(const std::string &filepath)
Definition file.cpp:96
void normalizePath(std::string &path)
Definition file.cpp:107
const std::string ARCHIVE_FILE_EXTENSION
Definition file.h:31
Definition file.h:28