Home > Software engineering >  Folder not found error even though the folder exists in c#
Folder not found error even though the folder exists in c#

Time:05-28

I have a piece of code in C# that states if a folder exists or not. In PC, you can specify the location and it will accurately state the existence of the folder. I then made the code run on Android by making an application in Unity. But, if I run it and input a location, it states that the folder does not exist even though it does! My folder location is like this: Phone storage/DCIM/Camera Am I doing anything wrong? My Code:

TMP_Text textBox;
string path;
if(Directory.Exists(path))
{textBox.text == "Yes";}
else {textBox.text == "No";}

CodePudding user response:

Thanks to this Post, I found a solution. The path I stated, "Phone storage/DCIM/Camera" was a simplification done by my phone's gallery and the correct technical path should be "/storage/emulated/0/DCIM/Camera". If I use this code it says that the folder exists :)

  • Related