import Nanoquery.IO def guaranteedTempFile() // create a file object to generate temp file names $namegen = new(File) // generate a temp filename $tempname = $namegen.tempFileName() // file names are generated with uuids so they shouldn't repeat // in the case that they do, generate new ones until the generated // filename is unique $tempfile = new(File, $tempname) while ($tempfile.exists()) $tempname = $namegen.tempFileName() $tempfile = new(File, $tempname) end // create the file and lock it from writing $tempfile.create() lock $tempfile.fullPath() // return the file reference return $tempfile end