Libraries: CDir (MT5) - a class for getting directory contents

 

CDir (MT5) - a class for getting directory contents:

The CDir class allows getting information about files and folders outside the MQL5 sandbox similar to the MS-DOS Dir command. Call of system DLL is used, therefore you should allow their use.

Author: Mikhail Dovbakh

 

there is a bug: 

total = Dir.Create(path);

if path is not exist , it will return 1. may be you can change it to -1.

 

change Dir.Create function:

int                Create(string path, string filter = "\\*")
{
 ...

if(hndl == 0)
  return (-1);
...
 
}

// change it to:
int                Create(string path, string filter = "\\*")
{
 ...

if(hndl == 0 || hndl == ULONG_MAX)
  return (-1);
...
 
}

everything is OK.

Reason: