mirror of
https://github.com/spice2x/spice2x.github.io.git
synced 2026-08-02 06:40:42 -07:00
cfg: use %appdata%\spice2x for new config files (#300)
## Link to GitHub Issue, if one exists n/a ## Description of change For JSON config files of the following features: * patch manager * screen resize * IIDX camera hook * card manager when saving a new file, store them in %appdata%\spice2x instead of %appdata%. On load: 1. If the JSON file exists in %appdata%\spice2x, use that (new path) 1. If the JSON file exists in %appdata%, continue to use that (legacy path) It's common for people to have mixed versions of spicetools/spice2x so we'll continue to read from the %appdata% root if the files are there, but with a preference for the new path. We will not forcibly move files. spicetools.xml will continue to live in the %appdata% root. Moving this will confuse a lot of people, so I'm avoiding this. Also, this fixes `-patchcfgpath` and `-resizecfgpath` to create directories as needed (previously the parent directory must have existed first) ## Testing Tested - * existing config files are continued to be read from %appdata% * new files get created in %appdata%\spice2x\... (both in spicecfg and in overlay) * can provide custom path for `-patchcfgpath` `-resizecfgpath` and observe directories + file created in custom path, try absolute or local relative paths
This commit is contained in:
@@ -60,7 +60,7 @@ namespace games::iidx {
|
||||
static IIDXLocalCamera *front_camera = nullptr; // camera id #1
|
||||
std::vector<IIDXLocalCamera*> LOCAL_CAMERA_LIST = {};
|
||||
static IDirect3DDeviceManager9 *s_pD3DManager = nullptr;
|
||||
std::filesystem::path CAMERA_CONFIG_PATH = std::filesystem::path(_wgetenv(L"APPDATA")) / L"spicetools_camera_control.json";
|
||||
std::filesystem::path CAMERA_CONFIG_PATH;
|
||||
bool CAMERA_READY = false;
|
||||
|
||||
bool parse_cmd_params() {
|
||||
@@ -493,7 +493,8 @@ namespace games::iidx {
|
||||
}
|
||||
|
||||
bool camera_config_load() {
|
||||
log_info("iidx:camhook", "loading config");
|
||||
CAMERA_CONFIG_PATH =
|
||||
fileutils::get_config_file_path("iidx::camhook", "spicetools_camera_control.json");
|
||||
|
||||
try {
|
||||
// read config file
|
||||
@@ -651,9 +652,9 @@ namespace games::iidx {
|
||||
doc.Accept(writer);
|
||||
|
||||
// save to file
|
||||
if (fileutils::text_write(CAMERA_CONFIG_PATH, buffer.GetString())) {
|
||||
if (fileutils::write_config_file("iidx::camhook", CAMERA_CONFIG_PATH, buffer.GetString())) {
|
||||
} else {
|
||||
log_warning("iidx:camhook", "unable to save config file to {}", CAMERA_CONFIG_PATH.string());
|
||||
log_warning("iidx:camhook", "unable to save config file");
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user