mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-06 11:31:49 +00:00
Added missing files
This commit is contained in:
parent
fee25abb5e
commit
5af04e20d1
4 changed files with 170 additions and 0 deletions
35
src/files/engine_files.cpp
Normal file
35
src/files/engine_files.cpp
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
#include "engine_files.h"
|
||||
|
||||
#include <filesystem>
|
||||
|
||||
namespace filesystem = std::filesystem;
|
||||
using std::string;
|
||||
using filesystem::path;
|
||||
|
||||
path enginefs::get_screenshot_file(string ext) {
|
||||
path folder = SCREENSHOTS_FOLDER;
|
||||
if (!filesystem::is_directory(folder)) {
|
||||
filesystem::create_directory(folder);
|
||||
}
|
||||
|
||||
auto t = std::time(nullptr);
|
||||
auto tm = *std::localtime(&t);
|
||||
|
||||
const char* format = "%d-%m-%Y_%H-%M-%S";
|
||||
|
||||
std::stringstream ss;
|
||||
ss << std::put_time(&tm, format);
|
||||
string datetimestr = ss.str();
|
||||
|
||||
path filename = folder/("screenshot-"+datetimestr+"."+ext);
|
||||
uint index = 0;
|
||||
while (filesystem::exists(filename)) {
|
||||
filename = folder/("screenshot-"+datetimestr+"-"+std::to_string(index)+"."+ext);
|
||||
index++;
|
||||
}
|
||||
return filename;
|
||||
}
|
||||
|
||||
path enginefs::get_worlds_folder() {
|
||||
return "worlds";
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue