Public Sub getSDCardPath() As String
' Private rp As RuntimePermissions
Dim iMount, iCRLF, iSlash, iAuto As Int
Dim fstab As String = File.ReadString("/system/etc/", "vold.fstab")
Dim Mount As String
Dim exten As String=File.DirDefaultExternal
Dim ptr1 As Int=exten.IndexOf("Android")
If ptr1=0 Then
Msgbox ("Unknown directory:" & exten,"Error")
End If
Do While True
'get next line with mount point:
iMount = fstab.IndexOf2("dev_mount ", iCRLF)
If iMount < 0 Then Exit
iCRLF = fstab.IndexOf2(CRLF, iMount)
If iCRLF < 0 Then Exit
Mount = fstab.SubString2(iMount, iCRLF)
'get mount path:
iSlash = Mount.IndexOf("/")
If iSlash < 0 Then Continue
iAuto = Mount.IndexOf2("auto", iSlash)
If iAuto < iSlash Then Continue
Mount = Mount.SubString2(iSlash, iAuto).Trim
'return this one, if new:
Log(Mount)
Log(File.DirDefaultExternal)
If Mount <> File.DirRootExternal Then
Try
File.WriteString( Mount & "/" & exten.SubString(ptr1),"txt.txt","test")
File.Delete( Mount & "/" & exten.SubString(ptr1),"txt.txt")
Return Mount & "/" & exten.SubString(ptr1)
Catch
Log("Do nothing")
End Try
End If
Loop
Return File.DirDefaultExternal
End Sub