Hi all. I am trying to assign a .csv file to the StreamWriter using the file path.
However, when executed it throws “System.IO.DirectoryNotFoundException”.
Someone have an idea about the reason it isn’t working?
Thanks
Try “./SSD/…”?
Tried. Still won’t work.
using (StreamWriter writer = new StreamWriter("./SSD/Users/damzSSD/Projects/GN_Gestione/DataLayerCSV/ListaClienti.csv"))
That is a relative path but it starts with “SSD/” which suggests an absolute path.
If you are sure that path is OK than let the program output its working directory. Maybe it is not what you expect.
so i have to get the working directory with some method and the compare it with the one i am setting in the StreamWriter path?
Try without the “SSD”-part. On my mac the HDD is called “Mac”, but it’s not a part of the file path. Go to the terminal and type “pwd” and see for yourself.
The path should be: “/Users/damzSSD/Projects/GN_Gestione/DataLayerCSV/ListaClienti.csv”
Still not working :
The path you want probably starts with /Users/damzSSD
. Your main volume is not part of the Unix path; it’s just /
. Secondary volumes typically start like /Volumes/NameOfVolume/
.
Try going to Finder, right-clicking the file, holding <kbd>opt</kbd> and choosing Copy as Pathname from the menu.
Still directory not found. I am coding a xamarin application: could be that it looks inside the emulated device instead than my hd?