Problem with TemporaryFile

Hey everyone,

I’m fairly new to interacting with files using JUCE, and was looking for some guidance. Basically, all I’m trying to do is copy some data from a preexisting file into a temporary file. This temp file exists in the audio processor (so it will get destroyed when the plugin instance is removed). I’m getting very strange results however. When I run the plugin no temporary files appear, however the folder’s “date modified” updates to the current time, which implies that the plug-in is at least trying to write something behind the scenes.

        //set the original file's path
        presetCode= juce::File ("/Absolute/Path To/File/Location");

        //create temp file in the same directory as original file
        juce::TemporaryFile tempCode(presetCode);
        //copy original file's contents to temp file

        //set input and output stream for temp file
        input= std::unique_ptr<juce::FileInputStream (tempCode.getFile().createInputStream());
        output= std::unique_ptr<juce::FileOutputStream> (tempCode.getFile().createOutputStream());

I’ve confirmed that the data actually is transferring to the temp file, I’ve confirmed that I have write access to the temp file, I’ve confirmed that manually writing to the temp file (instead of copying contents) doesn’t help anything, and I’ve confirmed that the temp file isn’t a hidden file. Any hypotheses would be much appreciated!

Welp, unsurprisingly it was a stupid mistake on my end. I was declaring my temporary files in the Audio Processor constructor and therefore they were immediately going out of scope and being deleted. I’ll leave this post up in case anyone else encounters something similar!