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,5 @@
If GetCalc("appvINPUT")
Disp "EXISTS",i
Else
Disp "DOES NOT EXIST",i
End

View file

@ -0,0 +1,38 @@
' FB 1.05.0 Win64
' Enable FileExists() function to be used
#include "file.bi"
' Use Win32 function to check if directory exists on Windows 10
Declare Function GetFileAttributes Lib "kernel32.dll" Alias "GetFileAttributesA" _
(ByVal lpFileName As ZString Ptr) As ULong
Const InvalidFileAttributes As ULong = -1UL
Const FileAttributeDirectory As ULong = &H10UL
Sub CheckFileExists(ByRef filePath As String)
If FileExists(filePath) Then
Print "'"; filePath; "' exists"
Else
Print "'"; filePath; "' does not exist"
End If
End Sub
Sub CheckDirectoryExists(ByVal dirPath As ZString Ptr)
Dim attrib As ULong = GetFileAttributes(dirPath)
Dim dirExists As ULong = attrib <> InvalidFileAttributes AndAlso (attrib And FileAttributeDirectory) <> 0
If dirExists Then
Print "'"; *dirPath; "' exists"
Else
Print "'"; *dirPath; "' does not exist"
End If
End Sub
CheckFileExists(CurDir + "\input.txt")
Dim dirPath As String = CurDir + "\docs"
CheckDirectoryExists(StrPtr(dirPath))
CheckFileExists("c:\input.txt")
CheckDirectoryExists(StrPtr("c:\docs"))
Print
Print "Press any key to quit the program"
Sleep

View file

@ -0,0 +1,16 @@
function exists(""filename) {
var file = open(filename)
issues {
print(filename+" does not exist")
return
}
print(filename+" exists")
close(file)
}
software {
exists("input.txt")
exists("/input.txt")
exists("docs")
exists("/docs")
}

View file

@ -0,0 +1,8 @@
> (: filelib is_regular '"input.txt")
false
> (: filelib is_dir '"docs")
false
> (: filelib is_regular '"/input.txt")
false
> (: filelib is_dir '"/docs"))
false

View file

@ -0,0 +1,11 @@
// local file
file_exists('input.txt')
// local directory
file_exists('docs')
// file in root file system (requires permissions at user OS level)
file_exists('//input.txt')
// directory in root file system (requires permissions at user OS level)
file_exists('//docs')

View file

@ -0,0 +1,4 @@
there is a file "/input.txt"
there is a file "input.txt"
there is a folder "docs"
there is a file "/docs/input.txt"

View file

@ -0,0 +1,2 @@
set the defaultFolder to "docs"
there is a file "input.txt"

View file

@ -0,0 +1,6 @@
import os
echo existsFile "input.txt"
echo existsFile "/input.txt"
echo existsDir "docs"
echo existsDir "/docs"

View file

@ -0,0 +1,18 @@
constant fd = {"file","directory"}
procedure check(string name)
object d = dir(name)
if sequence(d) then
d = (find('d',d[1][D_ATTRIBUTES])!=0)
printf(1,"%s %s exists.\n",{fd[1+d],name})
else
printf(1,"%s does not exist.\n",{name})
end if
end procedure
check("input.txt")
check("docs")
check("/input.txt")
check("/docs")
check("/pagefile.sys")
check("/Program Files (x86)")

View file

@ -0,0 +1,4 @@
aFile = "C:\Ring\ReadMe.txt"
see aFile
if Fexists(aFile) see " exists" + nl
else see " doesn't exist" + nl ok

View file

@ -0,0 +1,7 @@
# Here
say (Dir.cwd + %f'input.txt' -> is_file);
say (Dir.cwd + %d'docs' -> is_dir);
# Root
say (Dir.root + %f'input.txt' -> is_file);
say (Dir.root + %d'docs' -> is_dir);

View file

@ -0,0 +1,9 @@
def exists (string filename)
decl file f
try
f.open filename
return true
catch ioerror
return false
end try
end exists