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)
50
50
#endif
51
51
52
52
#ifdef _WASM
53
- inline static std::string get_cwd_from_env ()
53
+ inline static std::string get_cwd_from_env (const char * default_pwd )
54
54
{
55
55
char * value = getenv (" PWD" );
56
- if (!value) return " / " ;
56
+ if (!value) return default_pwd ;
57
57
return value;
58
58
}
59
59
#endif
@@ -68,8 +68,8 @@ namespace Sass {
68
68
{
69
69
#ifdef _WASM
70
70
// 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 (" ./ " );
73
73
#else
74
74
const size_t wd_len = 4096 ;
75
75
#ifndef _WIN32
@@ -189,7 +189,9 @@ namespace Sass {
189
189
while ((pos = path.find (" /./" , pos)) != std::string::npos) path.erase (pos, 2 );
190
190
191
191
// 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
193
195
while ((pos = path.length ()) > 1 && path[pos - 2 ] == ' /' && path[pos - 1 ] == ' .' ) path.erase (pos - 2 );
194
196
195
197
Original file line number Diff line number Diff line change 41
41
// enable loading of plugins for non-wasm
42
42
#ifndef _WASM
43
43
# define ENABLE_LOAD_PLUGINS
44
+ #else
45
+ # define PREOPEN_COMPATIBLE
44
46
#endif
45
47
46
48
// path separation char
You can’t perform that action at this time.
0 commit comments