Added force extension to saving files

This commit is contained in:
Yousef Khadadeh 2026-05-20 16:01:55 +03:00
parent 1d134e5d39
commit fc16d78bb8
4 changed files with 17 additions and 1 deletions

View file

@ -49,6 +49,7 @@
#include "CanvasComponents/CanvasComponentContainer.hpp"
#include "CanvasComponents/CanvasComponentAllocator.hpp"
#include "WorldScreenshot.hpp"
#include "FileHelpers.hpp"
#ifdef __EMSCRIPTEN__
#include <EmscriptenHelpers/emscripten_browser_file.h>
@ -478,7 +479,10 @@ void World::autosave_to_directory(const std::filesystem::path& directoryToSaveAt
void World::save_to_file(const std::filesystem::path& filePathToSaveAt) {
try {
filePath = filePathToSaveAt;
if(main.conf.forceExtensionOnPath)
filePath = force_extension_on_path(filePathToSaveAt, FILE_EXTENSION);
else
filePath = filePathToSaveAt;
std::stringstream f;
f.write(VersionConstants::CURRENT_SAVEFILE_HEADER.c_str(), VersionConstants::SAVEFILE_HEADER_LEN);