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()),
38 suffix, optionFlags)),
44 : temporaryFile (createTempFile (target.getParentDirectory(),
45 target.getFileNameWithoutExtension()
46 +
"_temp" +
String::toHexString (
Random::getSystemRandom().nextInt()),
47 target.getFileExtension(), optionFlags)),
51 jassert (targetFile !=
File());
55 : temporaryFile (temporary), targetFile (target)
80 jassert (targetFile !=
File());
82 if (temporaryFile.
exists())
85 for (
int i = 5; --i >= 0;)
106 for (
int i = 5; --i >= 0;)
Represents a local file or directory.
File getNonexistentChildFile(const String &prefix, const String &suffix, bool putNumbersInBrackets=true) const
Chooses a filename relative to this one that doesn't already exist.
bool deleteFile() const
Deletes a file.
bool replaceFileIn(const File &targetLocation) const
Replaces a file.
bool exists() const
Checks whether the file actually exists.
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...