Main Site Documentation

Missing System.IO.Directory method?


#1

The Microsoft NETMF 4.0 API reference shows that System.IO.Directory has two overloaded GetFiles methods. The one shown below, which takes a search pattern to match files against seems to be missing. Can anyone else verify that it seems to be absent?

public static string GetFiles (
         string path,
         string searchPattern
)

#2

Hi Jeff ,

it seems that the search patterns are absent.

What about the DirectoryInfo class? There were also methods that are using the search pattern.

Maybe you can also repeat the question in the Microsoft forum.


#3

Something strange here, indeed :confused:

Do you mean this page : http://msdn.microsoft.com/en-us/library/ee433841.aspx ?

From what I’ve seen on other sites, this method is used by .Net Framework, not MicroFramework. And all the samples in MicroFramework that were using GetFiles were using the one with only 1 parameter.


#4

But the link is related to the microframework.

Did anybody know how this class was implemented in the older version(e.g. 3.0)?

And btw the clickable links in this forum didn’t work :frowning:


#5

I took a look into the porting kit and there is a strange implementation

See here

That is the GetFiles method

public static string[] GetFiles(string path)
        {
            return GetChildren(path, "*", false);
        }

And here the GetChildren method

private static string[] GetChildren(string path, string searchPattern, bool isDirectory)
{
// path and searchPattern validation in Path.GetFullPath() and Path.NormalizePath()

        path = Path.GetFullPath(path);
        Path.NormalizePath(searchPattern, true);

        ArrayList fileNames = new ArrayList();

        string root = Path.GetPathRoot(path);
        if (String.Equals(root, path))
        {
            /// This is special case. Return all the volumes.
            /// Note this will not work, once we start having \\server\share like paths.

            if (isDirectory)
            {
                VolumeInfo[] volumes = VolumeInfo.GetVolumes();
                int count = volumes.Length;
                for (int i = 0; i < count; i++)
                {
                    fileNames.Add(volumes[i].RootDirectory);
                }
            }
        }

So searchpattern is implemented but not used :confused:

@ Support : code tags also didn’t work
When I add two diffferent code snippets only the first snippet was displayed , but two times.


#6

That is the page, look toward the bottom and you’ll see the NETMF versions that this method ‘should’ be in.