mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-09-11 13:36:08 +03:00
Merge pull request #1 from edwinb/remove-directory-system
Add rmDir to System.Directory
This commit is contained in:
commit
6bbb914fca
@ -266,6 +266,7 @@
|
||||
(define Directory-System-prim_createDir (lambda (farg-0 farg-1) ((foreign-procedure #f "idris2_createDir" (string) int) farg-0)))
|
||||
(define Directory-System-prim_closeDir (lambda (farg-0 farg-1) ((foreign-procedure #f "idris2_dirClose" (void*) void) farg-0) (vector 0 )))
|
||||
(define Directory-System-prim_changeDir (lambda (farg-0 farg-1) ((foreign-procedure #f "idris2_changeDir" (string) int) farg-0)))
|
||||
(define Directory-System-prim_rmDir (lambda (farg-0 farg-1) ((foreign-procedure #f "idris2_rmDir" (string) int) farg-0)))
|
||||
(define Buffer-Data-stringByteLength (lambda (farg-0) ((foreign-procedure #f "strlen" (string) int) farg-0)))
|
||||
(define Buffer-Data-prim__writeBuffer (lambda (farg-0 farg-1 farg-2 farg-3) (blodwen-write-bytevec farg-0 farg-1 farg-2)))
|
||||
(define Buffer-Data-prim__setString (lambda (farg-0 farg-1 farg-2 farg-3) (blodwen-buffer-setstring farg-0 farg-1 farg-2)))
|
||||
|
@ -41,6 +41,9 @@ prim_openDir : String -> PrimIO DirPtr
|
||||
%foreign support "idris2_dirClose"
|
||||
prim_closeDir : DirPtr -> PrimIO ()
|
||||
|
||||
%foreign support "idris2_rmDir"
|
||||
prim_rmDir : String -> PrimIO ()
|
||||
|
||||
%foreign support "idris2_nextDirEntry"
|
||||
prim_dirEntry : DirPtr -> PrimIO (Ptr String)
|
||||
|
||||
@ -82,6 +85,10 @@ export
|
||||
dirClose : Directory -> IO ()
|
||||
dirClose (MkDir d) = primIO (prim_closeDir d)
|
||||
|
||||
export
|
||||
rmDir : String -> IO ()
|
||||
rmDir dirName = primIO (prim_rmDir dirName)
|
||||
|
||||
export
|
||||
dirEntry : Directory -> IO (Either FileError String)
|
||||
dirEntry (MkDir d)
|
||||
|
@ -49,6 +49,10 @@ void idris2_dirClose(void* d) {
|
||||
free(di);
|
||||
}
|
||||
|
||||
int idris2_rmDir(char* path) {
|
||||
return rmdir(path);
|
||||
}
|
||||
|
||||
char* idris2_nextDirEntry(void* d) {
|
||||
DirInfo* di = (DirInfo*)d;
|
||||
struct dirent* de = readdir(di->dirptr);
|
||||
|
Loading…
Reference in New Issue
Block a user