Loading [MathJax]/extensions/tex2jax.js
ug4
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
mac_util.lua File Reference

Functions

function util createMacRAMDisk (name, sizeMB)
 

Function Documentation

◆ createMacRAMDisk()

function util createMacRAMDisk ( name  ,
sizeMB   
)

this function creates a RAM disk on Mac. it can be used for debug output, in case you want to have it faster or don't want to stress your SSD if the volume is already there, nothing is created keep in mind that RAM disks disappear after sleep or power off, so only use it as a debug output.

Parameters
namea std filename (don't use special characters or whitespace)
sizeMBthe size of the RAM Disk in MB

location: /home/runner/work/docs/docs/ug4/ugcore/scripts/util / mac_util.lua :38-49

function util.createMacRAMDisk(name, sizeMB)
ug_assert(GetOperatingSystem() == "apple", "only on apple systems")
if ProcRank() == 0 then
os.execute("if [ ! -e \"/Volumes/"..name.."\" ]; then\n"..
"echo \"Creating ug4 RAM Disk with "..sizeMB.." MB..\"\n"..
"diskutil erasevolume HFS+ '"..name.."' `hdiutil attach -nomount ram://"..(1024*1024*sizeMB/512).."`\n"..
"echo \"Access the RamDisk in /Volumes/"..name.."\"\n"..
"fi\n")
end
SynchronizeProcesses()
return "/Volumes/"..name
end
location name
Definition checkpoint_util.lua:128
function ug_assert(condition, msg)
if(!(yy_init))
Definition lexer.cpp:997