Hi, I have a problem in my program
My program checks if a specific directory exists
1) If NOT then It creates that folder & read all files in a list...
(It gives errors. It tries to read that folder before creating it)
How can I make my program to wait for creating that folders?
2) If YES then read all files in a list...
(Its Ok when that folder exists)
My program checks if a specific directory exists
1) If NOT then It creates that folder & read all files in a list...
(It gives errors. It tries to read that folder before creating it)
How can I make my program to wait for creating that folders?
2) If YES then read all files in a list...
(Its Ok when that folder exists)
B4X:
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("main")
If FirstTime Then
CheckFolders
End If
LoadNotes
End Sub
Sub CheckFolders
If File.Exists(File.DirRootExternal , "/fn/") = False Then
File.MakeDir(File.DirRootExternal , "/fn/")
End If
If File.Exists(File.DirRootExternal , "/fn/notes") = False Then
File.MakeDir(File.DirRootExternal , "/fn/notes")
End If
If File.Exists(File.DirRootExternal , "/fn/edit") = False Then
File.MakeDir(File.DirRootExternal , "/fn/edit")
End If
End Sub
Sub LoadNotes
Dim NoteFiles As List
NoteFiles = File.ListFiles(File.DirRootExternal & "/fn/notes/")
If NoteFiles.Size > 0 Then
NoteFiles.Sort(True)
...
End If
End Sub
Last edited: