I am having a very strange issue right now. I am attempting to get the files of a directory by using this code:
public static string[] fileList = Directory.GetFiles(@File.ReadAllText(Settings.localdir.Trim()));
However, when I do this, I get this error:
Access to the path 'C:\Users\lazho\Desktop' is denied.
But when I do this code:
public static string[] fileList = Directory.GetFiles(@"C:\Users\lazho\Desktop");
It works without any errors. I have no idea why one would throw an error when they both equal the same value. Any Ideas?
P.S. I have already tried this:
public static string dir = @File.ReadAllText(Settings.localdir.Trim());
public static string[] fileList = Directory.GetFiles(dir);