1 // 2 // Copyright 2018 The ANGLE Project Authors. All rights reserved. 3 // Use of this source code is governed by a BSD-style license that can be 4 // found in the LICENSE file. 5 // 6 7 // system_utils.cpp: Implementation of common functions 8 9 #include "common/system_utils.h" 10 11 namespace angle 12 { PrependPathToEnvironmentVar(const char * variableName,const char * path)13bool PrependPathToEnvironmentVar(const char *variableName, const char *path) 14 { 15 std::string oldValue = GetEnvironmentVar(variableName); 16 const char *newValue = nullptr; 17 std::string buf; 18 if (oldValue.empty()) 19 { 20 newValue = path; 21 } 22 else 23 { 24 buf = path; 25 buf += GetPathSeparatorForEnvironmentVar(); 26 buf += oldValue; 27 newValue = buf.c_str(); 28 } 29 return SetEnvironmentVar(variableName, newValue); 30 } 31 } // namespace angle 32