Hash :
eb63016d
Author :
Date :
2020-02-04T16:15:41
Add environment overrides for ANGLE features. Allows the application to override ANGLE behaviour without having to modify the code or use the ANGLE extension. Useful for testing with the command graph refactor. Adds a new string utility for parsing lists of strings from environment variables. Bug: angleproject:4029 Change-Id: Ibae93b743c0c385392cd259d9604ce2f2ed988dc Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2037784 Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: 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 "common/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 += GetPathSeparatorForEnvironmentVar();
buf += oldValue;
newValue = buf.c_str();
}
return SetEnvironmentVar(variableName, newValue);
}
} // namespace angle