This repository was archived by the owner on Oct 24, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -50,10 +50,10 @@ inline static std::string wstring_to_string(const std::wstring &wstr)
5050#endif
5151
5252#ifdef _WASM
53- inline static std::string get_cwd_from_env ()
53+ inline static std::string get_cwd_from_env (const char * default_pwd )
5454{
5555 char * value = getenv (" PWD" );
56- if (!value) return " / " ;
56+ if (!value) return default_pwd ;
5757 return value;
5858}
5959#endif
@@ -68,8 +68,8 @@ namespace Sass {
6868 {
6969 #ifdef _WASM
7070 // the WASI does not implement getcwd() yet --
71- // check the environment variables or default to "/".
72- std::string cwd = get_cwd_from_env ();
71+ // check the environment variables or default to ". /".
72+ std::string cwd = get_cwd_from_env (" ./ " );
7373 #else
7474 const size_t wd_len = 4096 ;
7575 #ifndef _WIN32
@@ -189,7 +189,9 @@ namespace Sass {
189189 while ((pos = path.find (" /./" , pos)) != std::string::npos) path.erase (pos, 2 );
190190
191191 // remove all leading and trailing self references
192- while (path.size () >= 2 && path[0 ] == ' .' && path[1 ] == ' /' ) path.erase (0 , 2 );
192+ #ifndef PREOPEN_COMPATIBLE
193+ while (path.size () >= 2 && path[0 ] == ' .' && path[1 ] == ' /' ) path.erase (0 , 2 );
194+ #endif
193195 while ((pos = path.length ()) > 1 && path[pos - 2 ] == ' /' && path[pos - 1 ] == ' .' ) path.erase (pos - 2 );
194196
195197
Original file line number Diff line number Diff line change 4141// enable loading of plugins for non-wasm
4242#ifndef _WASM
4343# define ENABLE_LOAD_PLUGINS
44+ #else
45+ # define PREOPEN_COMPATIBLE
4446#endif
4547
4648// path separation char
You can’t perform that action at this time.
0 commit comments