Skip to content

Commit 2450903

Browse files
committed
Use "/" for wasm's cwd when environment is not available.
1 parent a9262b1 commit 2450903

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/file.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ inline static std::string wstring_to_string(const std::wstring &wstr)
5454
inline static std::string get_cwd_from_env()
5555
{
5656
char* value = getenv("PWD");
57-
if (!value) return "(unreachable)";
57+
if (!value) return "/";
5858
return value;
5959
}
6060
#endif
@@ -68,6 +68,8 @@ namespace Sass {
6868
std::string get_cwd()
6969
{
7070
#ifdef _WASM
71+
// the WASI does not implement getcwd() yet --
72+
// check the environment variables or default to "/".
7173
std::string cwd = get_cwd_from_env();
7274
#else
7375
const size_t wd_len = 4096;

0 commit comments

Comments
 (0)