Add tasks for all the new languages

This commit is contained in:
Tina Müller 2016-12-05 23:44:36 +01:00
parent 9dc3c2bb62
commit bba7bfd280
13208 changed files with 134745 additions and 0 deletions

View file

@ -0,0 +1,43 @@
' FB 1.05.0 Win64
#Include "dir.bi"
Function IsDirEmpty(dirPath As String) As Boolean
Err = 0
' check dirPath is a valid directory
Dim As String fileName = Dir(dirPath, fbDirectory)
If Len(fileName) = 0 Then
Err = 1000 ' dirPath is not a valid path
Return False
End If
' now check if there are any files/subdirectories in it other than . and ..
Dim fileSpec As String = dirPath + "\*.*"
Const attribMask = fbNormal Or fbHidden Or fbSystem Or fbDirectory
Dim outAttrib As UInteger
fileName = Dir(fileSpec, attribMask, outAttrib) ' get first file
Do
If fileName <> ".." AndAlso fileName <> "." Then
If Len(fileName) = 0 Then Return True
Exit Do
End If
fileName = Dir ' get next file
Loop
Return False
End Function
Dim outAttrib As UInteger
Dim dirPath As String = "c:\freebasic\docs" ' known to be empty
Dim empty As Boolean = IsDirEmpty(dirPath)
Dim e As Long = Err
If e = 1000 Then
Print "'"; dirPath; "' is not a valid directory"
End
End If
If empty Then
Print "'"; dirPath; "' is empty"
Else
Print "'"; dirPath; "' is not empty"
End If
Print
Print "Press any key to quit"
Sleep

View file

@ -0,0 +1,3 @@
dir('has_content') -> isEmpty
'<br />'
dir('no_content') -> isEmpty

View file

@ -0,0 +1,3 @@
on isDirEmpty (dir)
return getNthFileNameInFolder(dir, 1) = EMPTY
end

View file

@ -0,0 +1,7 @@
import os, rdstdin
var empty = true
for f in walkDir(readLineFromStdin "directory: "):
empty = false
break
echo empty

View file

@ -0,0 +1,3 @@
myList = dir("C:\Ring\bin")
if len(myList) > 0 see "C:\Ring\bin is not empty" + nl
else see "C:\Ring\bin is empty" + nl ok

View file

@ -0,0 +1 @@
Dir.new('/my/dir').is_empty; # true, false or nil

View file

@ -0,0 +1,8 @@
func is_empty(dir) {
dir.open(\var dir_h) || return nil;
dir_h.each { |file|
file ~~ ['.', '..'] && next;
return false;
};
return true;
};