Skip to content

Commit c1e74c8

Browse files
committed
Trying to solve configuration issues.
1 parent 734fe91 commit c1e74c8

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

source/configuration/source/configuration.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,21 @@ int configuration_initialize(const char *reader, const char *path, void *allocat
101101
}
102102
}
103103

104+
#if (defined(WIN32) || defined(_WIN32)) && defined(_MSC_VER)
105+
/* Windows MSVC stores the build folder in Debug/Release folders, so we must also check in the parent folder */
106+
if (global == NULL)
107+
{
108+
static const char configuration_default_path_win32[] = ".." ENVIRONMENT_VARIABLE_PATH_SEPARATOR_STR CONFIGURATION_DEFAULT_PATH;
109+
110+
if (configuration_path_from_library_path(library_relative_path, configuration_default_path_win32, sizeof(configuration_default_path_win32)) == 0)
111+
{
112+
global = configuration_object_initialize(CONFIGURATION_GLOBAL_SCOPE, library_relative_path, NULL);
113+
114+
path = library_relative_path;
115+
}
116+
}
117+
#endif
118+
104119
if (global == NULL)
105120
{
106121
static const char relative_path[] = ".." ENVIRONMENT_VARIABLE_PATH_SEPARATOR_STR "share" ENVIRONMENT_VARIABLE_PATH_SEPARATOR_STR "metacall" ENVIRONMENT_VARIABLE_PATH_SEPARATOR_STR CONFIGURATION_DEFAULT_PATH;

source/configuration/source/configuration_object.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ configuration configuration_object_initialize(const char *name, const char *path
9696

9797
if (path != NULL)
9898
{
99+
log_write("metacall", LOG_LEVEL_DEBUG, "Trying to load configuration from %s", path);
100+
99101
config->source = configuration_object_read(path);
100102

101103
if (config->source == NULL)

0 commit comments

Comments
 (0)