MCPcopy Create free account
hub / github.com/apache/arrow / get_potential_libhdfs_paths

Function get_potential_libhdfs_paths

cpp/src/arrow/io/hdfs_internal.cc:114–237  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

112}
113
114Result<std::vector<PlatformFilename>> get_potential_libhdfs_paths() {
115 std::vector<PlatformFilename> potential_paths;
116 std::string file_name;
117
118// OS-specific file name
119#ifdef _WIN32
120 file_name = "hdfs.dll";
121#elif __APPLE__
122 file_name = "libhdfs.dylib";
123#else
124 file_name = "libhdfs.so";
125#endif
126
127 // Common paths
128 ARROW_ASSIGN_OR_RAISE(auto search_paths, MakeFilenameVector({"", "."}));
129
130 // Path from environment variable
131 AppendEnvVarFilename("HADOOP_HOME", "lib/native", &search_paths);
132 AppendEnvVarFilename("ARROW_LIBHDFS_DIR", &search_paths);
133
134 // All paths with file name
135 for (const auto& path : search_paths) {
136 ARROW_ASSIGN_OR_RAISE(auto full_path, path.Join(file_name));
137 potential_paths.push_back(std::move(full_path));
138 }
139
140 return potential_paths;
141}
142
143Result<std::vector<PlatformFilename>> get_potential_libjvm_paths() {
144 std::vector<PlatformFilename> potential_paths;
145
146 std::vector<PlatformFilename> search_prefixes;
147 std::vector<PlatformFilename> search_suffixes;
148 std::string file_name;
149
150// From heuristics
151#ifdef _WIN32
152 ARROW_ASSIGN_OR_RAISE(search_prefixes, MakeFilenameVector({""}));
153 ARROW_ASSIGN_OR_RAISE(search_suffixes,
154 MakeFilenameVector({"/jre/bin/server", "/bin/server"}));
155 file_name = "jvm.dll";
156#elif __APPLE__
157 ARROW_ASSIGN_OR_RAISE(search_prefixes, MakeFilenameVector({""}));
158 ARROW_ASSIGN_OR_RAISE(search_suffixes,
159 MakeFilenameVector({"/jre/lib/server", "/lib/server"}));
160 file_name = "libjvm.dylib";
161
162// SFrame uses /usr/libexec/java_home to find JAVA_HOME; for now we are
163// expecting users to set an environment variable
164#else
165# if defined(__aarch64__)
166 const std::string prefix_arch{"arm64"};
167 const std::string suffix_arch{"aarch64"};
168# else
169 const std::string prefix_arch{"amd64"};
170 const std::string suffix_arch{"amd64"};
171# endif

Callers

nothing calls this directly

Calls 2

AppendEnvVarFilenameFunction · 0.85
push_backMethod · 0.80

Tested by

no test coverage detected