blob: 6294d6ebbbd74cf2db0b196ff461b13b05df47b5 [file] [log] [blame]
Hardik Goyalb09d6b02019-08-13 16:15:50 -07001// Copyright 2019 The Chromium OS Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "debugd/src/helper_utils.h"
6
7#include <inttypes.h>
Simon Glassb51cc132020-06-10 12:30:53 -06008#include <limits.h>
Hardik Goyalb09d6b02019-08-13 16:15:50 -07009#include <vector>
10
11#include <base/strings/stringprintf.h>
12
13namespace debugd {
14
15bool GetHelperPath(const std::string& relative_path, std::string* full_path) {
16 const char* helpers_dir = "/usr/libexec/debugd/helpers";
17 std::string path =
18 base::StringPrintf("%s/%s", helpers_dir, relative_path.c_str());
19
Simon Glassb51cc132020-06-10 12:30:53 -060020 if (path.length() >= PATH_MAX)
Hardik Goyalb09d6b02019-08-13 16:15:50 -070021 return false;
22
23 *full_path = path;
24 return true;
25}
26
27} // namespace debugd