mirror of
https://github.com/Expand-sys/CCash
synced 2025-12-16 00:02:14 +11:00
✨ configurable save locations in CMake
This commit is contained in:
parent
1a77ca43dc
commit
aa71a9f538
4 changed files with 64 additions and 3 deletions
|
|
@ -29,6 +29,20 @@ target_sources(${PROJECT_NAME} PRIVATE
|
|||
src/xxhash_str.cpp
|
||||
)
|
||||
|
||||
if(USER_SAVE_LOC)
|
||||
set(USER_SAVE ${USER_SAVE_LOC})
|
||||
else()
|
||||
set(USER_SAVE "\"../users.json\"")
|
||||
endif()
|
||||
|
||||
if(DROGON_CONFIG_LOC)
|
||||
set(DROGON_CONFIG ${DROGON_CONFIG_LOC})
|
||||
else()
|
||||
set(DROGON_CONFIG "\"../config.json\"")
|
||||
endif()
|
||||
|
||||
configure_file(ccash_config.hpp.in ${CMAKE_CURRENT_SOURCE_DIR}/ccash_config.hpp)
|
||||
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC include)
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC third_party)
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC third_party/drogon/lib/inc)
|
||||
|
|
|
|||
39
ccash_config.hpp
Normal file
39
ccash_config.hpp
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
#pragma once
|
||||
|
||||
// Setting both values to 0 does not compile logging (useful for if disk/memory is very valuable)
|
||||
#define MAX_LOG_SIZE 100
|
||||
#define PRE_LOG_SIZE 10
|
||||
|
||||
//default to minecraft usernames
|
||||
constexpr unsigned min_name_size = 3;
|
||||
constexpr unsigned max_name_size = 16;
|
||||
|
||||
constexpr const char *users_location = "yo";
|
||||
constexpr const char *config_location = ;
|
||||
|
||||
// Returns money to an account on deletion (useful if you dont want any money to leave the economy)
|
||||
#define RETURN_ON_DEL false
|
||||
constexpr const char *return_account = "";
|
||||
|
||||
/*
|
||||
if true, when frequency is hit AND changes have happened then save
|
||||
pros
|
||||
LOW disk usage
|
||||
cons
|
||||
LOW atomic overhead
|
||||
if false, when frequency is hit save
|
||||
pros
|
||||
ZERO atomic overhead
|
||||
cons
|
||||
HIGH disk usage
|
||||
*/
|
||||
#define CONSERVATIVE_DISK_SAVE true
|
||||
|
||||
/*
|
||||
example, when set to 2
|
||||
version 1 will not work
|
||||
version 2 will work
|
||||
version 3 will work
|
||||
etc
|
||||
*/
|
||||
#define API_VERSION 1
|
||||
|
|
@ -4,11 +4,12 @@
|
|||
#define MAX_LOG_SIZE 100
|
||||
#define PRE_LOG_SIZE 10
|
||||
|
||||
//default to minecraft usernames
|
||||
constexpr unsigned min_name_size = 3;
|
||||
constexpr unsigned max_name_size = 16;
|
||||
|
||||
constexpr const char *users_location = "../users.json";
|
||||
constexpr const char *config_location = "../config.json";
|
||||
constexpr const char *users_location = @USER_SAVE@;
|
||||
constexpr const char *config_location = @DROGON_CONFIG@;
|
||||
|
||||
// Returns money to an account on deletion (useful if you dont want any money to leave the economy)
|
||||
#define RETURN_ON_DEL false
|
||||
|
|
@ -28,4 +29,11 @@ if false, when frequency is hit save
|
|||
*/
|
||||
#define CONSERVATIVE_DISK_SAVE true
|
||||
|
||||
/*
|
||||
example, when set to 2
|
||||
version 1 will not work
|
||||
version 2 will work
|
||||
version 3 will work
|
||||
etc
|
||||
*/
|
||||
#define API_VERSION 1
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
#include <json/json.h> // to be removed later
|
||||
#include <array>
|
||||
#include <algorithm>
|
||||
#include "consts.hpp"
|
||||
#include "ccash_config.hpp"
|
||||
#include "change_flag.h"
|
||||
#include "transaction.h"
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue