Hash :
046fa0ef
Author :
Date :
2018-02-02T14:51:36
Vulkan: Prepend layer path to VK_LAYER_PATH Directly setting this variable overwrites old value, as might be unexpected. Instead the path can be prepended to it, so that old value can still work. This is needed in order to use additional debugging layers, like the "api_dump" layer. See https://github.com/LunarG/VulkanTools for more. BUG=angleproject:2333 Change-Id: I5338a5b928ffa792cc9b6db5b69713320b5b0842 Reviewed-on: https://chromium-review.googlesource.com/898591 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
//
// Copyright 2018 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// system_utils.cpp: Implementation of common functions
#include "system_utils.h"
namespace angle
{
bool PrependPathToEnvironmentVar(const char *variableName, const char *path)
{
std::string oldValue = GetEnvironmentVar(variableName);
const char *newValue = nullptr;
std::string buf;
if (oldValue.empty())
{
newValue = path;
}
else
{
buf = path;
buf += GetPathSeparator();
buf += oldValue;
newValue = buf.c_str();
}
return SetEnvironmentVar(variableName, newValue);
}
} // namespace angle