mirror of
https://github.com/davidallendj/gdpm.git
synced 2025-12-20 03:27:02 -07:00
Updated README.md and .gitignore files
-Fixed issue where `gdpm` would to work because of missing directory -Changed `constexpr const char *` constants to use `const std::string` string instead to use with `HOME` variable -Changed where packages are stored. Now, they should stored in the user's `$HOME/.config/gdpm/packages.db` by default. This may change to use `$HOME/.cache/gdpm/packages.db` by default in the future.
This commit is contained in:
parent
2bf0186f98
commit
e36f0aee79
6 changed files with 75 additions and 58 deletions
|
|
@ -27,7 +27,7 @@ namespace gdpm::config{
|
|||
std::string to_json(const config_context& params);
|
||||
config_context load(std::filesystem::path path, int verbose = 0);
|
||||
int save(const config_context& config, int verbose = 0);
|
||||
config_context make_config(const std::string& username = GDPM_CONFIG_USERNAME, const std::string& password = GDPM_CONFIG_PASSWORD, const std::string& path = GDPM_CONFIG_PATH, const std::string& token = GDPM_CONFIG_TOKEN, const std::string& godot_version = GDPM_CONFIG_GODOT_VERSION, const std::string& packages_dir = GDPM_CONFIG_LOCAL_PACKAGES_DIR, const std::string& tmp_dir = GDPM_CONFIG_LOCAL_TMP_DIR, const std::set<std::string>& remote_sources = {GDPM_CONFIG_REMOTE_SOURCES}, size_t threads = GDPM_CONFIG_THREADS, size_t timeout = 0, bool enable_sync = GDPM_CONFIG_ENABLE_SYNC, bool enable_file_logging = GDPM_CONFIG_ENABLE_FILE_LOGGING, int verbose = GDPM_CONFIG_VERBOSE);
|
||||
config_context make_context(const std::string& username = GDPM_CONFIG_USERNAME, const std::string& password = GDPM_CONFIG_PASSWORD, const std::string& path = GDPM_CONFIG_PATH, const std::string& token = GDPM_CONFIG_TOKEN, const std::string& godot_version = GDPM_CONFIG_GODOT_VERSION, const std::string& packages_dir = GDPM_CONFIG_LOCAL_PACKAGES_DIR, const std::string& tmp_dir = GDPM_CONFIG_LOCAL_TMP_DIR, const std::set<std::string>& remote_sources = {GDPM_CONFIG_REMOTE_SOURCES}, size_t threads = GDPM_CONFIG_THREADS, size_t timeout = 0, bool enable_sync = GDPM_CONFIG_ENABLE_SYNC, bool enable_file_logging = GDPM_CONFIG_ENABLE_FILE_LOGGING, int verbose = GDPM_CONFIG_VERBOSE);
|
||||
|
||||
extern config_context config;
|
||||
}
|
||||
|
|
@ -2,25 +2,27 @@
|
|||
|
||||
#include <rapidjson/rapidjson.h>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
namespace gdpm::constants{
|
||||
constexpr const char *ConfigPath = "config.ini";
|
||||
constexpr const char *LocalPackagesDir = "$HOME/.config/gdpm";
|
||||
constexpr const char *UserAgent = "libcurl-agent/1.0";
|
||||
constexpr const char *AssetRepo = "https://godotengine.org/asset-library/api/asset";
|
||||
constexpr const char *HostUrl = "https://godotengine.org/asset-library/api";
|
||||
constexpr const char *LockfilePath = "$HOME/.config/gdpm/gdpm.lck";
|
||||
constexpr const char *TmpPath = "$HOME/.config/gdpm/tmp";
|
||||
const std::string HomePath(std::string(std::getenv("HOME")) + "/");
|
||||
const std::string ConfigPath(HomePath + ".config/gdpm/config.json");
|
||||
const std::string LockfilePath(HomePath + ".config/gdpm/gdpm.lck");
|
||||
const std::string LocalPackagesDir(HomePath + ".config/gdpm/packages");
|
||||
const std::string TemporaryPath(HomePath + ".config/gdpm/tmp");
|
||||
const std::string UserAgent("libcurl-agent/1.0");
|
||||
const std::string AssetRepo("https://godotengine.org/asset-library/api/asset");
|
||||
const std::string HostUrl("https://godotengine.org/asset-library/api");
|
||||
}
|
||||
|
||||
/* Define default macros to set when building with -DGPM_* */
|
||||
#define GDPM_CONFIG_USERNAME ""
|
||||
#define GDPM_CONFIG_PASSWORD ""
|
||||
#define GDPM_CONFIG_PATH "config.json"
|
||||
#define GDPM_CONFIG_PATH gdpm::constants::ConfigPath
|
||||
#define GDPM_CONFIG_TOKEN ""
|
||||
#define GDPM_CONFIG_GODOT_VERSION "3.4"
|
||||
#define GDPM_CONFIG_LOCAL_PACKAGES_DIR "tests/gdpm/packages"
|
||||
#define GDPM_CONFIG_LOCAL_TMP_DIR "tests/gdpm/.tmp"
|
||||
#define GDPM_CONFIG_LOCAL_PACKAGES_DIR gdpm::constants::LocalPackagesDir
|
||||
#define GDPM_CONFIG_LOCAL_TMP_DIR gdpm::constants::TemporaryPath
|
||||
#define GDPM_CONFIG_REMOTE_SOURCES constants::HostUrl
|
||||
#define GDPM_CONFIG_THREADS 1
|
||||
#define GDPM_CONFIG_TIMEOUT_MS 30000
|
||||
|
|
@ -30,7 +32,7 @@ namespace gdpm::constants{
|
|||
|
||||
/* Defines the default package cache for local storage */
|
||||
#define GDPM_PACKAGE_CACHE_ENABLE 1
|
||||
#define GDPM_PACKAGE_CACHE_PATH "tests/gdpm/packages.db"
|
||||
#define GDPM_PACKAGE_CACHE_PATH gdpm::constants::LocalPackagesDir + "/packages.db"
|
||||
#define GDPM_PACKAGE_CACHE_TABLENAME "cache"
|
||||
#define GDPM_PACKAGE_CACHE_COLNAMES "asset_id, type, title, author, author_id, version, godot_version, cost, description, modify_date, support_level, category, remote_source, download_url, download_hash, is_installed, install_path"
|
||||
|
||||
|
|
@ -55,25 +57,26 @@ namespace gdpm::constants{
|
|||
#define GDPM_DLL_EXPORT
|
||||
#define GDPM_DLL_IMPORT
|
||||
#endif
|
||||
|
||||
#define GDPM_READFILE_IMPL 1
|
||||
#define GDPM_DELAY_HTTP_REQUESTS 1
|
||||
|
||||
#ifndef GDPM_REQUEST_DELAY
|
||||
#define GDPM_REQUEST_DELAY 200ms
|
||||
#define GDPM_REQUEST_DELAY 200ms
|
||||
#endif
|
||||
|
||||
#ifndef GDPM_ENABLE_COLORS
|
||||
#define GDPM_ENABLE_COLORS 1
|
||||
#define GDPM_ENABLE_COLORS 1
|
||||
#endif
|
||||
|
||||
#ifndef GDPM_LOG_LEVEL
|
||||
#define GDPM_LOG_LEVEL 1
|
||||
#define GDPM_LOG_LEVEL 1
|
||||
#endif
|
||||
|
||||
#ifndef GDPM_ENABLE_TIMESTAMPS
|
||||
#define GDPM_ENABLE_TIMESTAMPS 1
|
||||
#define GDPM_ENABLE_TIMESTAMPS 1
|
||||
#endif
|
||||
|
||||
#ifndef GDPM_TIMESTAMP_FORMAT
|
||||
#define GDPM_TIMESTAMP_FORMAT ":%I:%M:%S %p; %Y-%m-%d"
|
||||
#define GDPM_TIMESTAMP_FORMAT ":%I:%M:%S %p; %Y-%m-%d"
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue