Пытаюсь сделать это в компиляторе андроид:
using(StreamReader sr = new StreamReader(
@"\storage\emulated\0\Download\27-A_demo.txt")){/*...*/}
Слэши поставлены те, которые нужны, а если писать '/', то будет ошибка неправильного формата строки пути.
Получаю ошибку о том, что файл не найден, из которой понятно, что программа пытается искать указанный мной путь в директории с файлом кода .cs.
System.IO.FileNotFoundException:
Could not find file "/storage/emulated/0/
programs/c#/egeinf/\storage\emulated\0
\Download\27-A_demo.txt"
File name:'/storage/emulated/0/
programs/c#/egeinf/\storage\emulated\0
\Download\27-A_demo.txt'
at System.IO.FileStream..ctor
(System.String path, System.IO.FileMode
mode, System.IO.FileAccess
access, System.IO.FileShare share,
System.Int32 bufferSize, System.Boolean
anonymous, System.IO.FileOptions
options) [0x001b7] in
<c72658f647bc485bbfb8c9fcaa790862>:
0
at System.IO.FileStream..ctor
(System.String path, System.IO.FileMode
mode, System.IO.FileAccess access,
System.IO.FileShare share, System.Int32
bufferSize, System.IO.FileOptions
options) [0x00000] in
<c72658f647bc485bbfb8c9fcaa790862>:
0
at (wrapper remoting-invoke-with-check)
System.IO.FileStream..ctor(string,System.IO.
FileMode,System.IO.FileAccess,System.IO.
FileShare,int,System.IO.FileOptions)
at System.IO.StreamReader..ctor
Как указать рабочий абсолютный путь? Чтобы открывать файл из любой директории, не перетаскивая туда скрипт.