Create the custom_maps folder on startup when it is missing.

This commit is contained in:
justinfilip committed 2026-10-11 17:03:37 -05:00
1 parent 67f2214219
commit 05dd9ccdea
3 files changed
+24

No files matched your search

+4
View File
@@ -8,6 +8,7 @@ SHELL.C
#include "shell.h"
#include "errors.h"
#include "tag_files.h"
#include "files.h"
#include "real_math.h"
#include "game_state.h"
#include "rasterizer.h"
@@ -36,6 +37,9 @@ boolean shell_initialize(
errors_initialize();
tag_files_open();
/* port: Custom Edition maps live in custom_maps, beside maps.
Make that folder when this launch does not already have it. */
directory_create("custom_maps");
real_math_initialize();
game_state_initialize();
+19
View File
@@ -291,6 +291,25 @@ void directory_create_or_delete_contents(
return;
}
/* port: make the folder when it is missing. An existing folder is left
alone, including whatever is already in it. */
void directory_create(
const char *directory_name)
{
struct file_reference directory;
struct file_reference_info *info = (struct file_reference_info *)&directory;
memset(info, 0, FILE_REFERENCE_SIZE);
info->signature = FILE_REFERENCE_SIGNATURE;
info->location = NONE;
file_reference_add_directory(&directory, directory_name);
if (!file_exists(&directory))
file_create(&directory);
return;
}
boolean datastore_read(
const char *file_name,
const char *field_name,
+1
View File
@@ -146,6 +146,7 @@ char *file_reference_get_name(const struct file_reference *reference, unsigned l
boolean file_references_equal(const struct file_reference *reference0, const struct file_reference *reference1);
struct file_reference *file_reference_create_from_path(struct file_reference *reference, const char *path, boolean is_directory);
void directory_create_or_delete_contents(const char *directory_name);
void directory_create(const char *directory_name);
boolean datastore_read(const char *file_name, const char *field_name, long length, void *data);
boolean datastore_write(const char *file_name, const char *field_name, long length, const void *data);