Daniel Shroff
Daniel Shroff

Reputation: 23

Could not find a part of the path in visual studio for Mac

I am trying to code a command line interface, the beginning has a scan for DLLs in a relevant folder (/dlls) but keeps throwing this error: Could not find a part of the path '/Users/danielshroff/Projects/Meh-Rewrite/Meh-Rewrite/bin/Debug/dlls)'. The path exists and I have copied and followed it exactly using finder goto folder

edit: i also tried using the full path but no luck

using System.IO;

 namespace MehRewrite
{
class MainClass
{
    public static void Main(string[] args)
    {
        Console.WriteLine("MEH System Version 1.0");
        Console.WriteLine("Loading Core System");
        Console.WriteLine("Declaring Startup Variables");
        String dlls = null;
        Console.WriteLine("Startup Variables Declared");
        Console.WriteLine("Searching for dlls");
        foreach (var file in Directory.GetFiles(@"./dlls)", "*.dll")) 
        {

            dlls = dlls + file;
            Console.WriteLine(file); }
        int present = dlls.IndexOf("tinyMath.dll", StringComparison.Ordinal);

        Console.Write("Enter Secure Mode? ");
        variables.secure = Console.ReadLine();

Upvotes: 2

Views: 1518

Answers (1)

Matt Ward
Matt Ward

Reputation: 47907

The problem is you have a ')' at the end of the path string you are passing to Directory.GetFiles.

The line should be:

foreach (var file in Directory.GetFiles(@"./dlls", "*.dll"))

Upvotes: 3

Related Questions