summaryrefslogtreecommitdiff
path: root/src/support/path.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/support/path.h')
-rw-r--r--src/support/path.h37
1 files changed, 13 insertions, 24 deletions
diff --git a/src/support/path.h b/src/support/path.h
index 5852fcc4d..505ba0d88 100644
--- a/src/support/path.h
+++ b/src/support/path.h
@@ -28,30 +28,19 @@ namespace wasm {
namespace Path {
-inline std::string getPathSeparator() {
- // TODO: use c++17's path separator
- // http://en.cppreference.com/w/cpp/experimental/fs/path
-#if defined(WIN32) || defined(_WIN32)
- return "\\";
-#else
- return "/";
-#endif
-}
-
-inline std::string getBinaryenRoot() {
- auto* envVar = getenv("BINARYEN_ROOT");
- if (envVar) return envVar;
- return ".";
-}
-
-inline std::string getBinaryenBinDir() {
- return getBinaryenRoot() + getPathSeparator() + "bin" + getPathSeparator();
-}
-
-// Gets the path to a binaryen binary tool, like wasm-opt
-inline std::string getBinaryenBinaryTool(std::string name) {
- return getBinaryenBinDir() + name;
-}
+std::string getPathSeparator();
+
+// Get the binaryen root dor.
+std::string getBinaryenRoot();
+
+// Get the binaryen bin dir.
+std::string getBinaryenBinDir();
+
+// Set the binaryen bin dir (allows tools to change it based on user input).
+void setBinaryenBinDir(std::string dir);
+
+// Gets the path to a binaryen binary tool, like wasm-opt.
+std::string getBinaryenBinaryTool(std::string name);
} // namespace Path