diff --git a/platform/config.c b/platform/config.c index 5f9d2dd..5bbceea 100644 --- a/platform/config.c +++ b/platform/config.c @@ -17,6 +17,7 @@ #include "platform/clock.h" #include "platform/dns.h" #include "platform/es3sec.h" +#include "util/dprintf.h" void platform_config_load(struct platform_config *cfg, const wchar_t *filename) { @@ -46,17 +47,23 @@ void vfs_config_load(struct vfs_config *cfg, const wchar_t *filename) GetPrivateProfileStringW( L"vfs", L"path", - L"", + L"\0", cfg->path, _countof(cfg->path), filename); len = wcslen(cfg->path); + + if (cfg->path[0] == L'\0') { + dprintf("No vfs folder specified, using default 'vfs' at CWD\n"); + GetCurrentDirectoryW(_countof(cfg->path), cfg->path); + wcscat_s(cfg->path, _countof(cfg->path), L"vfs"); + } if (cfg->path[len - 2] != '\\' && cfg->path[len - 2] != '/') { // -2 for null terminator StringCbCatW(cfg->path, sizeof(cfg->path), L"\\\0"); } - + wcscpy_s(cfg->d, sizeof(cfg->d), cfg->path); wcscpy_s(cfg->e, sizeof(cfg->d), cfg->path); wcscpy_s(cfg->f, sizeof(cfg->d), cfg->path); diff --git a/platform/vfs.c b/platform/vfs.c index 43bb247..32b1171 100644 --- a/platform/vfs.c +++ b/platform/vfs.c @@ -40,11 +40,6 @@ HRESULT vfs_hook_init(const struct vfs_config *config) memcpy(&vfs_config, config, sizeof(*config)); - if (config->path[0] == L'\0') { - dprintf("No vfs folder specified, using default 'vfs' at CWD\n"); - wcscpy_s(vfs_config.path, _countof(config->path), L"vfs"); - } - vfs_fixup_path(vfs_config.path, _countof(vfs_config.path)); vfs_fixup_path(vfs_config.d, _countof(vfs_config.d)); vfs_fixup_path(vfs_config.e, _countof(vfs_config.e));