start_in_dir.hpp
Go to the documentation of this file.
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 //
7 // Distributed under the Boost Software License, Version 1.0. (See accompanying
8 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9 
10 #pragma once
11 
12 #include <filesystem>
13 #include <string>
14 
16 
18 {
19 
20  template <class String>
22  {
23  public:
24  explicit start_in_dir_(const String& s) : s_(s)
25  {
26  }
27 
28  template <class WindowsExecutor>
29  void
30  on_CreateProcess_setup(WindowsExecutor& e) const
31  {
32  e.work_dir = s_.c_str();
33  }
34 
35  private:
36  String s_;
37  };
38 
39 #if defined(_UNICODE) || defined(UNICODE)
40  inline start_in_dir_<std::wstring>
41  start_in_dir(const wchar_t* ws)
42  {
43  return start_in_dir_<std::wstring>(ws);
44  }
45 
46  inline start_in_dir_<std::wstring>
47  start_in_dir(const std::wstring& ws)
48  {
49  return start_in_dir_<std::wstring>(ws);
50  }
51 
52  inline start_in_dir_<std::wstring>
53  start_in_dir(const std::filesystem::path& p)
54  {
55  return start_in_dir_<std::wstring>(p.wstring());
56  }
57 #else
58  inline start_in_dir_<std::string>
59  start_in_dir(const char* s)
60  {
62  }
63 
64  inline start_in_dir_<std::string>
65  start_in_dir(const std::string& s)
66  {
68  }
69 
70  inline start_in_dir_<std::string>
71  start_in_dir(const std::filesystem::path& p)
72  {
73  return start_in_dir_<std::string>(p.string());
74  }
75 #endif
76 
77 } // namespace boost::process::windows::initializers
boost::process::windows::initializers::start_in_dir_::on_CreateProcess_setup
void on_CreateProcess_setup(WindowsExecutor &e) const
Definition: start_in_dir.hpp:30
boost::process::windows::initializers::start_in_dir_
Definition: start_in_dir.hpp:21
boost::process::windows::initializers::start_in_dir_::start_in_dir_
start_in_dir_(const String &s)
Definition: start_in_dir.hpp:24
boost::process::windows::initializers::start_in_dir
start_in_dir_< std::string > start_in_dir(const char *s)
Definition: start_in_dir.hpp:59
boost::process::windows::initializers
Definition: bind_stderr.hpp:17
cxxopts::String
std::string String
Definition: cxxopts.hpp:192
initializer_base.hpp
boost::process::windows::initializers::initializer_base
Definition: initializer_base.hpp:15
armarx::ctrlutil::s
double s(double t, double s0, double v0, double a0, double j)
Definition: CtrlUtil.h:33