File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11// Copyright (c) 2022-present INESC-ID.
22// Distributed under the MIT license that can be found in the LICENSE file.
33
4- #include < llvm/Support/CommandLine.h>
5-
64#include < algorithm>
75#include < array>
86#include < cstdlib>
97#include < filesystem>
108#include < fstream>
119#include < vector>
12-
1310#if defined(_WIN32)
1411#include < windows.h>
1512#elif defined(__linux__)
1916#include < mach-o/dyld.h>
2017#endif
2118
19+ #include < llvm/Support/CommandLine.h>
20+
2221#include " cpp2rust_lib.h"
2322#include " logging.h"
2423
@@ -66,6 +65,7 @@ llvm::cl::list<std::string> CXXFlags("cxxflags",
6665
6766} // namespace
6867
68+ // Get the directory of the running executable
6969static fs::path GetExecutableDir () {
7070#if defined(_WIN32)
7171 char path[MAX_PATH ];
@@ -78,7 +78,7 @@ static fs::path GetExecutableDir() {
7878 .parent_path ();
7979#elif defined(__APPLE__)
8080 uint32_t size = 0 ;
81- _NSGetExecutablePath (nullptr , &size);
81+ _NSGetExecutablePath (nullptr , &size); // get path length
8282 std::vector<char > buffer (size);
8383 _NSGetExecutablePath (buffer.data (), &size);
8484 return fs::path (buffer.data ()).parent_path ();
You can’t perform that action at this time.
0 commit comments