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

Function get_potential_libhdfs_paths

cpp/src/arrow/filesystem/hdfs_internal.cc:123–246  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

AppendEnvVarFilenameFunction · 0.85
push_backMethod · 0.80

Tested by

no test coverage detected