aboutsummaryrefslogtreecommitdiff
path: root/main/Windows/CoclSystemDependent.icl
blob: 867bcd231dc8789dbda693af824a9829079f670c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// this is for Windows
implementation module CoclSystemDependent

import StdEnv
import code from "cDirectory.obj",  library "directory_library" // Windows

PathSeparator
	:==	';'
DirectorySeparator
	:== '\\'

SystemDependentDevices :: [a]
SystemDependentDevices
		=	[]

SystemDependentInitialIO :: [a]
SystemDependentInitialIO
		=	[]

ensureCleanSystemFilesExists :: !String !*Files -> (!Bool, !*Files)
// returned bool: now there is such a subfolder
ensureCleanSystemFilesExists path env
	# path_c_string = path +++ "\0"
	  (err_code, env) = createDirectoryC path_c_string env
	= (err_code==M_NoDirError || err_code==M_AlreadyExists, env)

createDirectoryC :: !String !*env -> (!Int, !*env)
createDirectoryC _ _
	= code
		{
			ccall createDirectoryC "S:I:A"
		}

// createDirectoryC returns the following error codes:
M_NoDirError		:==  0
M_OtherDirError		:== -1
M_DoesntExist		:== -2
M_BadName			:== -3
M_NotEnoughSpace	:== -4
M_AlreadyExists		:== -5
M_NoPermission		:== -6