Skip to content

Commit

Permalink
Use "/" for wasm's cwd when environment is not available.
Browse files Browse the repository at this point in the history
  • Loading branch information
yurydelendik committed Jun 13, 2019
1 parent a9262b1 commit 2450903
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ inline static std::string wstring_to_string(const std::wstring &wstr)
inline static std::string get_cwd_from_env()
{
char* value = getenv("PWD");
if (!value) return "(unreachable)";
if (!value) return "/";
return value;
}
#endif
Expand All @@ -68,6 +68,8 @@ namespace Sass {
std::string get_cwd()
{
#ifdef _WASM
// the WASI does not implement getcwd() yet --
// check the environment variables or default to "/".
std::string cwd = get_cwd_from_env();
#else
const size_t wd_len = 4096;
Expand Down

0 comments on commit 2450903

Please sign in to comment.