diff options
Diffstat (limited to 'site/udo/host_platform.udo')
-rwxr-xr-x | site/udo/host_platform.udo | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/site/udo/host_platform.udo b/site/udo/host_platform.udo new file mode 100755 index 0000000..2b82eb7 --- /dev/null +++ b/site/udo/host_platform.udo @@ -0,0 +1,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
|