blob: c274563c64487d337b36a7a0ffc13b45ad3399e5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
// file : bpkg/utility.cxx -*- C++ -*-
// copyright : Copyright (c) 2014-2015 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
#include <bpkg/utility>
#include <system_error>
#include <butl/filesystem>
#include <bpkg/types>
#include <bpkg/diagnostics>
using namespace std;
using namespace butl;
namespace bpkg
{
bool
exists (const path& f)
{
try
{
return file_exists (f);
}
catch (const system_error& e)
{
error << "unable to stat path " << f << ": " << e.what ();
throw failed ();
}
}
bool
exists (const dir_path& d)
{
try
{
return file_exists (d);
}
catch (const system_error& e)
{
error << "unable to stat path " << d << ": " << e.what ();
throw failed ();
}
}
}
|