Commit 1cc641e7 authored by John van Groningen's avatar John van Groningen

add import code from "cDirectory." for the Macintosh,

add getFileName
parent 82fbb4e9
......@@ -33,6 +33,8 @@ getFileInfo :: !Path !*env -> (!(!DirError, FileInfo), !*env) | FileSystem env
error codes: NoDirError, DoesntExist, BadName, NoPermission, OtherDirError
The returned FileInfo is only valid, if the error code is NoDirError */
getFileName :: !Path !*env -> (!(!DirError, String), !*env) | FileSystem env
createDirectory :: !Path !*env -> (!DirError, !*env) | FileSystem env
/* error codes: NoDirError, DoesntExist, BadName, NotEnoughSpace, AlreadyExists, NoPermission,
......@@ -9,6 +9,7 @@ implementation module Directory
import StdEnv
import code from "cDirectory.obj", library "directory_library" // this is the only platform dependent line in this module
//import code from "cDirectory." // for the Macintosh
import StdMaybe
from StdLibMisc import Date, Time
......@@ -178,6 +179,27 @@ getFileInfo path files
self = "getFileInfo"
getFileName :: !Path !*env -> (!(!DirError, String), !*env) | FileSystem env
getFileName (AbsolutePath _ []) files
= ((BadName, fail "getFileName"), files)
getFileName path files
# (platformId, files) = getPlatformIdC dummy files
| isBadPath path platformId
= ((BadName, fail self), files)
# (path_string, files)= pathToPD_String path files
(errCode, files) = findSingleFileC (path_string+++"\0") files
(result, files)
= case errCode of
M_NoDirError# (entry, files) = getDirEntry True platformId files
-> ((NoDirError, entry.fileName), files)
_ -> ((toDirError [M_DoesntExist, M_BadName, M_NoPermission, M_OtherDirError]
errCode, fail self)
, files)
files = closeSingleSearchC files
= (result, files)
self = "getFileName"
fmove :: !MoveMode !Path !Path !*env -> (!DirError, !*env) | FileSystem env
fmove moveMode p_fromm p_to env
# (platformId, env) = getPlatformIdC dummy env
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment