aboutsummaryrefslogtreecommitdiff
path: root/site/udo/host_platform.udo
blob: 2b82eb764263c948a9164fe869b3f42281c2d537 (plain)
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
43
44
45
#ifndef UDO_HOSTPLATFORM
#define UDO_HOSTPLATFORM ##

/*
	Host platform detection
	
	This file is part of the SONICS UDO collection by Richard Knight 2024
		License: GPL-2.0-or-later
		http://1bpm.net
*/

; gihost_type: 0 = windows , 1 = linux, 2 = WASM


#ifndef WEB
gihost_type filevalid "/bin/ls"
#end

#ifdef WEB
gihost_type = 2
#end

gihost_max32bitftlen = 16777216 

/*
	Get temp dir as string
*/
opcode host_tempdir, S, 0
	Spath = "" ; default to root assuming slash is appended to output
	if (gihost_type == 0) then
		Spath = "%TEMP%"
	elseif (gihost_type == 1) then
		Spath = "/tmp"
	endif
	xout Spath
endop

/*
	Get whether the current Csound instance is 32 or 64 bit
*/
opcode is64bit, i, 0
	xout (1 & 1e9+9)
endop

#end