Skip to content

Commit

Permalink
Make sys_read_dir errors consistent between platforms
Browse files Browse the repository at this point in the history
Haxe documentation specifies that an exception should be thrown if the path is not a valid directory. This was already the case on all platforms except Windows, where `null` was returned. Now the behavior is consistent.
  • Loading branch information
tobil4sk committed Mar 7, 2024
1 parent 4f73919 commit cd31fff
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/hx/libs/std/Sys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ Array<String> _hx_std_sys_read_dir( String p )
const wchar_t *path = p.wchar_str();
size_t len = wcslen(path);
if (len>MAX_PATH)
return null();
hx::Throw(HX_CSTRING("Invalid directory"));

WIN32_FIND_DATAW d;
HANDLE handle;
Expand Down Expand Up @@ -698,7 +698,7 @@ Array<String> _hx_std_sys_read_dir( String p )
if( handle == INVALID_HANDLE_VALUE )
{
hx::ExitGCFreeZone();
return null();
hx::Throw(HX_CSTRING("Invalid directory"));
}
while( true )
{
Expand Down

0 comments on commit cd31fff

Please sign in to comment.