Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
44
Task/Empty-directory/FutureBasic/empty-directory.basic
Normal file
44
Task/Empty-directory/FutureBasic/empty-directory.basic
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
include "NSLog.incl"
|
||||
|
||||
local fn DirectoryContents( url as CFURLRef ) as CFArrayRef
|
||||
CFArrayRef contents = fn FileManagerContentsOfDirectoryAtURL( url, NULL, NSDirectoryEnumerationSkipsHiddenFiles )
|
||||
if ( contents == NULL )
|
||||
NSLog(@"Unable to get contents of directory \"%@\".",fn URLLastPathComponent(url))
|
||||
end if
|
||||
end fn = fn ArrayValueForKey( contents, @"lastPathComponent" )
|
||||
|
||||
void local fn DoIt
|
||||
CFURLRef dirURL, fileURL
|
||||
CFArrayRef contents
|
||||
|
||||
dirURL = fn URLFileURLWithPath( fn StringByExpandingTildeInPath( @"~/Desktop/docs" ) )
|
||||
if ( fn FileManagerCreateDirectoryAtURL( dirURL, YES, NULL ) )
|
||||
contents = fn DirectoryContents( dirURL )
|
||||
if ( contents )
|
||||
NSLog(@"Directory \"docs\" \b")
|
||||
if ( len(contents) )
|
||||
NSLog(@"contents:\n%@",contents)
|
||||
else
|
||||
NSLog(@"is empty.")
|
||||
end if
|
||||
|
||||
NSLog(@"")
|
||||
|
||||
fileURL = fn URLFileURLWithPath( fn StringByExpandingTildeInPath( @"~/Desktop/docs/output.txt" ) )
|
||||
if (fn FileManagerCreateFileAtURL( fileURL, NULL, NULL ) )
|
||||
contents = fn DirectoryContents( dirURL )
|
||||
NSLog(@"Directory \"docs\" \b")
|
||||
if ( len(contents) )
|
||||
NSLog(@"contents:\n%@",contents)
|
||||
else
|
||||
NSLog(@"is empty.")
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
|
||||
end fn
|
||||
|
||||
fn DoIt
|
||||
|
||||
HandleEvents
|
||||
Loading…
Add table
Add a link
Reference in a new issue