Skip to content

Commit cd31fff

Browse files
committed
Make sys_read_dir errors consistent between platforms
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.
1 parent 4f73919 commit cd31fff

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/hx/libs/std/Sys.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ Array<String> _hx_std_sys_read_dir( String p )
669669
const wchar_t *path = p.wchar_str();
670670
size_t len = wcslen(path);
671671
if (len>MAX_PATH)
672-
return null();
672+
hx::Throw(HX_CSTRING("Invalid directory"));
673673

674674
WIN32_FIND_DATAW d;
675675
HANDLE handle;
@@ -698,7 +698,7 @@ Array<String> _hx_std_sys_read_dir( String p )
698698
if( handle == INVALID_HANDLE_VALUE )
699699
{
700700
hx::ExitGCFreeZone();
701-
return null();
701+
hx::Throw(HX_CSTRING("Invalid directory"));
702702
}
703703
while( true )
704704
{

0 commit comments

Comments
 (0)