When I open a file from File.DirApp. Everything works well.
If I try to open a file for example from the drive "C: \"
How do I open a file that is on the drive "C: \" for example?
B4X:
fileChooser.Initialize
fileChooser.InitialDirectory=File.DirApp
fileChooser.SetExtensionFilter("txt", Array("*.txt"))
NameForSave=File.GetName(fileChooser.ShowOpen(MainForm))
lblStat.Text=(NameForSave)
Log("Выбран файл: "&NameForSave)
If NameForSave.Length>0 Then
raf.Initialize(File.DirApp, NameForSave, False)
TimerOTP.Initialize("TimerOTP",2)
TimerOTP.Enabled=True
Else
B4X:
fileChooser.Initialize
fileChooser.InitialDirectory="C:\"
fileChooser.SetExtensionFilter("txt", Array("*.txt"))
NameForSave=File.GetName(fileChooser.ShowOpen(MainForm))
lblStat.Text=(NameForSave)
Log("Выбран файл: "&NameForSave)
If NameForSave.Length>0 Then
raf.Initialize("C:\", NameForSave, False)
TimerOTP.Initialize("TimerOTP",2)
TimerOTP.Enabled=True
Else
B4X:
Выбран файл: ttt.txt
main._btnos_action (java line: 588)
java.io.FileNotFoundException: C:\ttt.txt (Отказано в доступе)
at java.io.RandomAccessFile.open0(Native Method)
at java.io.RandomAccessFile.open(RandomAccessFile.java:316)
at java.io.RandomAccessFile.<init>(RandomAccessFile.java:243)
at anywheresoftware.b4a.randomaccessfile.RandomAccessFile.Initialize2(RandomAccessFile.java:72)
at anywheresoftware.b4a.randomaccessfile.RandomAccessFile.Initialize(RandomAccessFile.java:65)
at b4j.liana.write.novinka.wr.main._btnos_action(main.java:588)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:90)
at anywheresoftware.b4a.BA$1.run(BA.java:215)
at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
at java.lang.Thread.run(Thread.java:745)