26static File createTempFile (
const File& parentDirectory, String name,
27 const String& suffix,
int optionFlags)
36 : temporaryFile (createTempFile (
File::getSpecialLocation (
File::tempDirectory),
37 "temp_" +
String::toHexString (
Random::getSystemRandom().nextInt()),
44 : temporaryFile (createTempFile (target.getParentDirectory(),
45 target.getFileNameWithoutExtension()
46 +
"_temp" +
String::toHexString (
Random::getSystemRandom().nextInt()),
51 jassert (targetFile !=
File());
55 : temporaryFile (
temporary), targetFile (target)
80 jassert (targetFile !=
File());
82 if (temporaryFile.exists())
85 for (
int i = 5; --i >= 0;)
87 if (temporaryFile.replaceFileIn (targetFile))
106 for (
int i = 5; --i >= 0;)
108 if (temporaryFile.deleteFile())
Holds a resizable array of primitive or copy-by-value objects.
Represents a local file or directory.
A random number generator.
@ putNumbersInBrackets
Indicates that when numbers are appended to make sure the file is unique, they should go in brackets ...
@ useHiddenFile
Indicates that the temporary file should be hidden - i.e.
bool deleteTemporaryFile() const
Attempts to delete the temporary file, if it exists.
bool overwriteTargetFileWithTemporary() const
Tries to move the temporary file to overwrite the target file that was specified in the constructor.
~TemporaryFile()
Destructor.
TemporaryFile(const String &suffix=String(), int optionFlags=0)
Creates a randomly-named temporary file in the default temp directory.
static void JUCE_CALLTYPE sleep(int milliseconds)
Suspends the execution of the current thread until the specified timeout period has elapsed (note tha...