The following single line of PureBasic code will create a standalone x86 executable (4.5 KiB (4,608 bytes) on Windows version) that displays a message box with the text " Hello World". It can compile console applications, GUI applications, and DLL files. The compiler produces native executables and the syntax of PureBasic is simple and straightforward, comparable to plain C without the brackets and with native unicode string handling and a large library of built-in support functions. The AmigaOS version is legacy and open-source. Currently supported systems are Windows, Linux, macOS. PureBasic is a native cross platform 32 bit and 64 bit BASIC compiler. Other 3D environments such as the Irrlicht Engine are unofficially supported. PureBasic supports and has integrated the OGRE 3D Environment. PureBasic supports inline assembly, allowing the developer to include FASM assembler commands within PureBasic source code, while using the variables declared in PureBasic source code, enabling experienced programmers to improve the speed of speed-critical sections of code. Programs developed without using the platform-specific application programming interfaces (APIs) can be built easily from the same source file with little or no modification. PureBasic compiles directly to IA-32, x86-64, PowerPC or 680x0 instruction sets, generating small standalone executables and DLLs which need no runtime libraries beyond the standard system libraries. As cited on the website, the first PureBasic user (who registered in 1998) still has free access to new updates and this is not going to change. PureBasic has a "lifetime license model". It has been continually updated ever since. The first public release of PureBasic for Windows was on 17 December 2000. An Amiga version is available, although it has been discontinued and some parts of it are released as open-source. Note, symbolic links’ targets are resolved, so accessVia could in fact be a symbolic link to an empty directory.PureBasic is a commercially distributed procedural computer programming language and integrated development environment based on BASIC and developed by Fantaisie Software for Windows, Linux, and macOS. Program emptyDirectory ( input, output ) type path = string ( 1024 ) var s : path begin readLn ( s ) writeLn ( isEmptyDirectory ( s )) end. If (fn FileManagerCreateFileAtURL( fileURL, NULL, NULL ) )Ĭontents = fn Director圜ontents( dirURL \"docs\" \b") If ( fn FileManagerCreateDirectoryAtURL( dirURL, YES, NULL ) )Ĭontents = fn Director圜ontents( dirURL )Įnd = fn URLFileURLWithPath( fn StringByExpandingTildeInPath( ) ) If ( contents = NULL to get contents of directory URLLastPathComponent(url))Įnd fn = fn ArrayValueForKey( contents, )ĭirURL = fn URLFileURLWithPath( fn StringByExpandingTildeInPath( ) ) Local fn Director圜ontents( url as CFURLRef ) as CFArrayRefĬFArrayRef contents = fn FileManagerContentsOfDirectoryAtURL( url, NULL, NSDirectoryEnumerationSkipsHiddenFiles ) 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 ' 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. Print( ( argv( i ), " is ", IF is empty directory( argv( i ) ) THEN "empty" ELSE "not empty" FI, newline ) ) # have a directory name - report whether it is emty or not # # marker to indicate directory names follow # ![]() # show whether the directories specified on the command line ( following "-" ) are empty or not # # test the is empty directory procedure # WHILE result := files = "." OR files = "." STRING files = get directory( directory ) # directory is empty if it contains no files or just "." and possibly "." # PROC is empty directory = ( STRING directory )BOOL: # returns TRUE if the specified directory is empty, FALSE if it doesn't exist or is non-empty #
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |