diff --git a/src/messages/initialize.cc b/src/messages/initialize.cc index 016ad68c..4fc49675 100644 --- a/src/messages/initialize.cc +++ b/src/messages/initialize.cc @@ -5,6 +5,9 @@ #include +#define _STRINGIFY(x) #x +#define ENSURE_STRING_MACRO_ARGUMENT(x) _STRINGIFY(x) + namespace { struct Ipc_InitializeRequest : public IpcMessage { const static IpcId kIpcId = IpcId::Initialize; @@ -86,11 +89,12 @@ struct InitializeHandler : BaseMessageHandler { // Ensure there is a resource directory. if (config->resourceDirectory.empty()) { - std::string defaultResourceDirectory = std::string(DEFAULT_RESOURCE_DIRECTORY); + std::string defaultResourceDirectory = std::string( + ENSURE_STRING_MACRO_ARGUMENT(DEFAULT_RESOURCE_DIRECTORY)); if (defaultResourceDirectory.find("..") != std::string::npos) { std::string executablePath = GetExecutablePath(); size_t pos = executablePath.find_last_of('/'); - config->resourceDirectory = executablePath.substr(0, pos+1); + config->resourceDirectory = executablePath.substr(0, pos + 1); config->resourceDirectory += defaultResourceDirectory; } else { config->resourceDirectory = defaultResourceDirectory;