• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

STEllAR-GROUP / hpx / #848

07 Dec 2022 11:00PM CUT coverage: 86.456% (+0.6%) from 85.835%
#848

push

StellarBot
Merge #6096

6096: Forking Boost.Tokenizer r=hkaiser a=hkaiser

- flyby: remove more Boost headers that are not needed anymore

Working towards #3440 

Co-authored-by: Hartmut Kaiser <hartmut.kaiser@gmail.com>

525 of 525 new or added lines in 20 files covered. (100.0%)

173087 of 200202 relevant lines covered (86.46%)

1845223.38 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/components/process/src/util/posix/search_path_u.cpp
1
// Copyright (c) 2006, 2007 Julio M. Merino Vidal
2
// Copyright (c) 2008 Ilya Sokolov, Boris Schaeling
3
// Copyright (c) 2009 Boris Schaeling
4
// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
5
// Copyright (c) 2011, 2012 Jeff Flinn, Boris Schaeling
6
// Copyright (c) 2016-2022 Hartmut Kaiser
7
//
8
//  SPDX-License-Identifier: BSL-1.0
9
// Distributed under the Boost Software License, Version 1.0. (See accompanying
10
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
11

12
#include <hpx/config.hpp>
13

14
#if !defined(HPX_WINDOWS)
15
#include <hpx/components/process/util/search_path.hpp>
16
#include <hpx/modules/errors.hpp>
17
#include <hpx/modules/filesystem.hpp>
18
#include <hpx/modules/string_util.hpp>
19

20
#include <unistd.h>
21

22
#include <cstdlib>
23
#include <stdexcept>
24
#include <string>
25

26
namespace hpx { namespace components { namespace process { namespace posix {
27
    std::string search_path(const std::string& filename, std::string path)
×
28
    {
29
        if (path.empty())
×
30
        {
31
            path = ::getenv("PATH");
×
32
            if (path.empty())
×
33
            {
34
                HPX_THROW_EXCEPTION(invalid_status, "process::search_path",
×
35
                    "Environment variable PATH not found");
36
            }
37
        }
×
38

39
        std::string result;
×
40
        typedef hpx::string_util::tokenizer<
41
            hpx::string_util::char_separator<char>>
42
            tokenizer;
43
        hpx::string_util::char_separator<char> sep(":");
×
44
        tokenizer tok(path, sep);
×
45
        for (tokenizer::iterator it = tok.begin(); it != tok.end(); ++it)
×
46
        {
47
            filesystem::path p = *it;
×
48
            p /= filename;
×
49
            if (!::access(p.c_str(), X_OK))
×
50
            {
51
                result = p.string();
×
52
                break;
×
53
            }
54
        }
×
55
        return result;
×
56
    }
×
57
}}}}    // namespace hpx::components::process::posix
58

59
#endif
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc