aboutsummaryrefslogtreecommitdiff
path: root/site/udo/host_platform.udo
diff options
context:
space:
mode:
authorRichard <q@1bpm.net>2025-04-13 18:48:02 +0100
committerRichard <q@1bpm.net>2025-04-13 18:48:02 +0100
commit9fbf91db06a6d4f4b5cd8bb45389a731bb86bf22 (patch)
tree291bd79ce340e67affa755a8a6b4f6a83cce93ea /site/udo/host_platform.udo
downloadapps.csound.1bpm.net-9fbf91db06a6d4f4b5cd8bb45389a731bb86bf22.tar.gz
apps.csound.1bpm.net-9fbf91db06a6d4f4b5cd8bb45389a731bb86bf22.tar.bz2
apps.csound.1bpm.net-9fbf91db06a6d4f4b5cd8bb45389a731bb86bf22.zip
initial
Diffstat (limited to 'site/udo/host_platform.udo')
-rwxr-xr-xsite/udo/host_platform.udo45
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