Sub AppStart (Args() As String)
For Each s As String In Array("C:\Users\H\Documents\AddLib", "C:\Users\H\Documents\AddLib\b4j", "C:\Users\H\Documents\AddLib\B4i")
File.Copy("", "X2 Source Code\X2.b4xlib", s, "X2.b4xlib")
Next
SearchForObjectsFolders(File.DirApp)
End Sub
Private Sub SearchForObjectsFolders (Parent As String)
For Each f As String In File.ListFiles(Parent)
If File.IsDirectory(Parent, f) Then
Dim folder As String = File.Combine(Parent, f)
If f.ToLowerCase = "objects" Or f.ToLowerCase = "autobackups" Then
RecursiveDelete(folder)
Else If f.ToLowerCase = "files" Then
HandleFilesFolder(folder)
Else
SearchForObjectsFolders(folder)
End If
End If
Next
End Sub
Private Sub HandleFilesFolder (Folder As String)
For Each f As String In File.ListFiles(Folder)
If File.Size(Folder, f) > 2 And Regex.IsMatch(".*\.b.?l", f) = False And f <> "objecttypes.json" Then
File.WriteString(Folder, f, "")
End If
Next
End Sub
Private Sub RecursiveDelete(folder As String)
For Each f As String In File.ListFiles(folder)
If File.IsDirectory(folder, f) Then
RecursiveDelete(File.Combine(folder, f))
End If
File.Delete(folder, f)
Next
End Sub