27 : fullPath (parseAbsolutePath (fullPathName))
39 : fullPath (other.fullPath)
45 fullPath = parseAbsolutePath (newPath);
51 fullPath = other.fullPath;
56 : fullPath (std::move (other.fullPath))
62 fullPath = std::move (other.fullPath);
66 JUCE_DECLARE_DEPRECATED_STATIC (
const File File::nonexistent{};)
81 bool anythingChanged =
false;
83 for (
int i = 1; i < toks.
size(); ++i)
87 if (t ==
".." && toks[i - 1] !=
"..")
89 anythingChanged =
true;
95 anythingChanged =
true;
158 auto path = removeEllipsis (p);
173 if (
auto* pw = getpwnam (userName.toUTF8()))
179 #if JUCE_DEBUG || JUCE_LOG_ASSERTIONS 191 #if JUCE_LOG_ASSERTIONS 215 #define NAMES_ARE_CASE_SENSITIVE 1 220 #if NAMES_ARE_CASE_SENSITIVE 227 static int compareFilenames (
const String& name1,
const String& name2) noexcept
229 #if NAMES_ARE_CASE_SENSITIVE 238 bool File::operator< (
const File& other)
const {
return compareFilenames (fullPath, other.fullPath) < 0; }
239 bool File::operator> (
const File& other)
const {
return compareFilenames (fullPath, other.fullPath) > 0; }
243 const bool applyRecursively)
const 249 worked = f.setReadOnly (shouldBeReadOnly,
true) && worked;
251 return setFileReadOnlyInternal (shouldBeReadOnly) && worked;
256 return setFileExecutableInternal (shouldBeExecutable);
265 worked = f.deleteRecursively (followSymlinks) && worked;
272 if (newFile.fullPath == fullPath)
278 #if ! NAMES_ARE_CASE_SENSITIVE 279 if (*
this != newFile)
284 return moveInternal (newFile);
289 return (*
this == newFile)
295 if (newFile.fullPath == fullPath)
301 if (! replaceInternal (newFile))
313 if (! f.copyFileTo (newDirectory.
getChildFile (f.getFileName())))
317 if (! f.copyDirectoryTo (newDirectory.
getChildFile (f.getFileName())))
327 String File::getPathUpToLastSlash()
const 332 return fullPath.
substring (0, lastSlash);
356 if (lastDot > lastSlash)
357 return fullPath.
substring (lastSlash, lastDot);
364 if (potentialParent.fullPath.
isEmpty())
367 auto ourPath = getPathUpToLastSlash();
369 if (compareFilenames (potentialParent.fullPath, ourPath) == 0)
372 if (potentialParent.fullPath.
length() >= ourPath.length())
384 auto firstChar = *(path.
text);
388 || (firstChar != 0 && path.
text[1] ==
':');
396 auto r = relativePath.
text;
402 if (r.indexOf ((juce_wchar)
'/') >= 0)
406 auto path = fullPath;
412 auto secondChar = *++r;
414 if (secondChar ==
'.')
416 auto thirdChar = *++r;
418 if (thirdChar == separatorChar || thirdChar == 0)
425 while (*r == separatorChar)
434 else if (secondChar == separatorChar || secondChar == 0)
436 while (*r == separatorChar)
462 if (bytes == 1) { suffix =
" byte"; }
463 else if (bytes < 1024) { suffix =
" bytes"; }
464 else if (bytes < 1024 * 1024) { suffix =
" KB"; divisor = 1024.0; }
465 else if (bytes < 1024 * 1024 * 1024) { suffix =
" MB"; divisor = 1024.0 * 1024.0; }
466 else { suffix =
" GB"; divisor = 1024.0 * 1024.0 * 1024.0; }
468 return (divisor > 0 ?
String (bytes / divisor, 1) :
String (bytes)) + suffix;
479 if (parentDir == *
this)
482 auto r = parentDir.createDirectory();
500 if (parentDir == *
this)
503 auto r = parentDir.createDirectory();
549 findChildFiles (results, whatToLookFor, searchRecursively, wildcard);
559 results.
add (di.getFile());
588 bool putNumbersInBrackets)
const 595 auto prefix = suggestedPrefix;
598 if (prefix.trim().endsWithChar (
')'))
600 putNumbersInBrackets =
true;
603 auto closeBracks = prefix.lastIndexOfChar (
')');
606 && closeBracks > openBracks
607 && prefix.substring (openBracks + 1, closeBracks).containsOnly (
"0123456789"))
609 number = prefix.substring (openBracks + 1, closeBracks).getIntValue();
610 prefix = prefix.substring (0, openBracks);
616 auto newName = prefix;
618 if (putNumbersInBrackets)
620 newName <<
'(' << ++number <<
')';
632 }
while (f.exists());
645 putNumbersInBrackets);
664 auto semicolon = possibleSuffix.
text.
indexOf ((juce_wchar)
';');
672 if (possibleSuffix.
text[0] ==
'.')
675 auto dotPos = fullPath.
length() - possibleSuffix.
length() - 1;
678 return fullPath[dotPos] ==
'.';
691 auto lastDot = filePart.lastIndexOfChar (
'.');
694 filePart = filePart.substring (0, lastDot);
714 return fin.release();
721 std::unique_ptr<FileOutputStream> out (
new FileOutputStream (*
this, bufferSize));
723 return out->failedToOpen() ? nullptr
729 const size_t numberOfBytes)
const 731 jassert (((ssize_t) numberOfBytes) >= 0);
733 if (numberOfBytes == 0)
737 return out.
openedOk() && out.
write (dataToAppend, numberOfBytes);
741 const size_t numberOfBytes)
const 743 if (numberOfBytes == 0)
758 return out.
writeText (text, asUnicode, writeHeaderBytes, lineFeed);
764 tempFile.
getFile().
appendText (textToWrite, asUnicode, writeHeaderBytes, lineFeed);
777 if (in1.openedOk() && in2.
openedOk())
779 const int bufferSize = 4096;
784 auto num1 = in1.read (buffer1, bufferSize);
785 auto num2 = in2.
read (buffer2, bufferSize);
793 if (memcmp (buffer1, buffer2, (
size_t) num1) != 0)
808 if (s.isNotEmpty() && s[1] ==
':')
822 const int maxLength = 128;
827 auto lastDot = s.lastIndexOfChar (
'.');
829 if (lastDot > jmax (0, len - 12))
831 s = s.substring (0, maxLength - (len - lastDot))
832 + s.substring (lastDot);
836 s = s.substring (0, maxLength);
867 auto thisPath = fullPath;
875 int commonBitLength = 0;
877 auto dirPathAfterCommon = dirPath.getCharPointer();
880 auto thisPathIter = thisPath.getCharPointer();
881 auto dirPathIter = dirPath.getCharPointer();
886 auto c2 = dirPathIter.getAndAdvance();
888 #if NAMES_ARE_CASE_SENSITIVE 900 thisPathAfterCommon = thisPathIter;
901 dirPathAfterCommon = dirPathIter;
908 if (commonBitLength == 0 || (commonBitLength == 1 && thisPath[1] ==
getSeparatorChar()))
911 auto numUpDirectoriesNeeded = countNumberOfSeparators (dirPathAfterCommon);
913 if (numUpDirectoriesNeeded == 0)
914 return thisPathAfterCommon;
921 s.appendCharPointer (thisPathAfterCommon);
932 if (tempFile.exists())
939 const String& nativePathOfTarget,
940 bool overwriteExisting)
942 if (linkFileToCreate.
exists())
952 if (overwriteExisting)
956 #if JUCE_MAC || JUCE_LINUX 970 targetFile.isDirectory() ? SYMBOLIC_LINK_FLAG_DIRECTORY : 0) != FALSE;
972 ignoreUnused (nativePathOfTarget);
997 openInternal (file, mode, exclusive);
1001 : range (fileRange.getIntersectionWith (
Range<int64> (0, file.
getSize())))
1003 openInternal (file, mode, exclusive);
1013 FileTests() :
UnitTest (
"Files",
"Files") {}
1015 void runTest()
override 1017 beginTest (
"Reading");
1022 expect (!
File().exists());
1023 expect (!
File().existsAsFile());
1024 expect (!
File().isDirectory());
1026 expect (
File(
"/").isDirectory());
1048 expect (roots.
size() > 0);
1050 int numRootsExisting = 0;
1051 for (
int i = 0; i < roots.
size(); ++i)
1052 if (roots[i].exists())
1056 expect (numRootsExisting > 0);
1059 beginTest (
"Writing");
1062 expect (demoFolder.deleteRecursively());
1063 expect (demoFolder.createDirectory());
1064 expect (demoFolder.isDirectory());
1065 expect (demoFolder.getParentDirectory() == temp);
1070 File tempFile (demoFolder.getNonexistentChildFile (
"test",
".txt",
false));
1072 expect (tempFile.getFileExtension() ==
".txt");
1073 expect (tempFile.hasFileExtension (
".txt"));
1074 expect (tempFile.hasFileExtension (
"txt"));
1075 expect (tempFile.withFileExtension (
"xyz").hasFileExtension (
".xyz"));
1076 expect (tempFile.withFileExtension (
"xyz").hasFileExtension (
"abc;xyz;foo"));
1077 expect (tempFile.withFileExtension (
"xyz").hasFileExtension (
"xyz;foo"));
1078 expect (! tempFile.withFileExtension (
"h").hasFileExtension (
"bar;foo;xx"));
1079 expect (tempFile.getSiblingFile (
"foo").isAChildOf (temp));
1080 expect (tempFile.hasWriteAccess());
1097 fo.
write (
"0123456789", 10);
1100 expect (tempFile.exists());
1101 expect (tempFile.getSize() == 10);
1103 expectEquals (tempFile.loadFileAsString(),
String (
"0123456789"));
1104 expect (! demoFolder.containsSubDirectories());
1106 expectEquals (tempFile.getRelativePathFrom (demoFolder.getParentDirectory()), demoFolder.getFileName() +
File::getSeparatorString() + tempFile.getFileName());
1112 demoFolder.getNonexistentChildFile (
"tempFolder",
"",
false).createDirectory();
1115 expect (demoFolder.containsSubDirectories());
1117 expect (tempFile.hasWriteAccess());
1118 tempFile.setReadOnly (
true);
1119 expect (! tempFile.hasWriteAccess());
1120 tempFile.setReadOnly (
false);
1121 expect (tempFile.hasWriteAccess());
1124 tempFile.setLastModificationTime (t);
1125 Time t2 = tempFile.getLastModificationTime();
1126 expect (std::abs ((
int) (t2.
toMilliseconds() - t.toMilliseconds())) <= 1000);
1130 tempFile.loadFileAsData (mb);
1132 expect (mb[0] ==
'0');
1136 expect (tempFile.getSize() == 10);
1138 expect (fo.openedOk());
1140 expect (fo.setPosition (7));
1141 expect (fo.truncate().wasOk());
1142 expect (tempFile.getSize() == 7);
1143 fo.write (
"789", 3);
1145 expect (tempFile.getSize() == 10);
1148 beginTest (
"Memory-mapped files");
1153 expect (mmf.
getData() !=
nullptr);
1154 expect (memcmp (mmf.
getData(),
"0123456789", 10) == 0);
1158 const File tempFile2 (tempFile.getNonexistentSibling (
false));
1159 expect (tempFile2.create());
1160 expect (tempFile2.appendData (
"xxxxxxxxxx", 10));
1165 expect (mmf.
getData() !=
nullptr);
1166 memcpy (mmf.
getData(),
"abcdefghij", 10);
1172 expect (mmf.
getData() !=
nullptr);
1173 expect (memcmp (mmf.
getData(),
"abcdefghij", 10) == 0);
1176 expect (tempFile2.deleteFile());
1179 beginTest (
"More writing");
1181 expect (tempFile.appendData (
"abcdefghij", 10));
1182 expect (tempFile.getSize() == 20);
1183 expect (tempFile.replaceWithData (
"abcdefghij", 10));
1184 expect (tempFile.getSize() == 10);
1186 File tempFile2 (tempFile.getNonexistentSibling (
false));
1187 expect (tempFile.copyFileTo (tempFile2));
1188 expect (tempFile2.exists());
1189 expect (tempFile2.hasIdenticalContentTo (tempFile));
1190 expect (tempFile.deleteFile());
1191 expect (! tempFile.exists());
1192 expect (tempFile2.moveFileTo (tempFile));
1193 expect (tempFile.exists());
1194 expect (! tempFile2.exists());
1196 expect (demoFolder.deleteRecursively());
1197 expect (! demoFolder.exists());
1201 static FileTests fileUnitTests;
size_t getSize() const noexcept
Returns the block's current allocated size, in bytes.
bool copyFileTo(const File &targetLocation) const
Copies a file.
String getFileName() const
Returns the last section of the pathname.
Manages a temporary file, which will be deleted when this object is deleted.
bool setReadOnly(bool shouldBeReadOnly, bool applyRecursively=false) const
Changes the write-permission of a file or directory.
Result create() const
Creates an empty file if it doesn't already exist.
bool operator!=(const File &) const
Compares the pathnames for two files.
static Random & getSystemRandom() noexcept
The overhead of creating a new Random object is fairly small, but if you want to avoid it...
bool appendText(const String &textToAppend, bool asUnicode=false, bool writeUnicodeHeaderBytes=false, const char *lineEndings="\") const
Appends a string to the end of the file.
int64 hashCode64() const noexcept
Generates a probably-unique 64-bit hashcode from this string.
bool hasIdenticalContentTo(const File &other) const
Attempts to scan the contents of this file and compare it to another file, returning true if this is ...
Indicates that the memory can only be read.
bool setCreationTime(Time newTime) const
Changes the creation date for this file.
File getSiblingFile(StringRef siblingFileName) const
Returns a file which is in the same directory as this one.
String fromFirstOccurrenceOf(StringRef substringToStartFrom, bool includeSubStringInResult, bool ignoreCase) const
Returns a section of the string starting from a given substring.
static Result ok() noexcept
Creates and returns a 'successful' result.
static bool isAbsolutePath(StringRef path)
Returns true if the string seems to be a fully-specified absolute path.
const char * toRawUTF8() const
Returns a pointer to a UTF-8 version of this string.
bool copyDirectoryTo(const File &newDirectory) const
Copies a directory.
bool createSymbolicLink(const File &linkFileToCreate, bool overwriteExisting) const
Tries to create a symbolic link and returns a boolean to indicate success.
bool appendData(const void *dataToAppend, size_t numberOfBytes) const
Appends a block of binary data to the end of the file.
bool operator<(const File &) const
Compares the pathnames for two files.
static String createLegalPathName(const String &pathNameToFix)
Returns a version of a path with any illegal characters removed.
bool overwriteTargetFileWithTemporary() const
Tries to move the temporary file to overwrite the target file that was specified in the constructor...
bool endsWithChar(juce_wchar character) const noexcept
Tests whether the string ends with a particular character.
bool isNotEmpty() const noexcept
Returns true if the string contains at least one character.
Searches through the files in a directory, returning each file that is found.
The user's default documents folder.
const File & getFile() const noexcept
Returns the temporary file.
const Result & getStatus() const noexcept
Returns the status of the file stream.
A simple class for holding temporary references to a string literal or String.
bool isAChildOf(const File &potentialParentDirectory) const
Checks whether a file is somewhere inside a directory.
bool setLastAccessTime(Time newTime) const
Changes the last-access time for this file.
int length() const noexcept
Returns the number of characters in the string.
File getParentDirectory() const
Returns the directory that contains this file or directory.
static File createFileWithoutCheckingPath(const String &absolutePath) noexcept
Creates a file that simply contains this string, without doing the sanity-checking that the normal co...
void add(const ElementType &newElement)
Appends a new element at the end of the array.
Time getLastModificationTime() const
Returns the last modification time of this file.
Result createDirectory() const
Creates a new directory for this filename.
bool deleteFile() const
Deletes a file.
bool isNotEmpty() const noexcept
Returns true if the string is not empty.
String trimCharactersAtEnd(StringRef charactersToTrim) const
Returns a copy of this string, having removed a specified set of characters from its end...
Indicates that the temporary file should be hidden - i.e.
void remove(int index)
Removes a string from the array.
bool containsChar(juce_wchar character) const noexcept
Tests whether the string contains a particular character.
bool endsWithIgnoreCase(StringRef text) const noexcept
Tests whether the string ends with another string.
Indicates that the memory can be read and written to - changes that are made will be flushed back to ...
The user's home folder.
bool replaceWithText(const String &textToWrite, bool asUnicode=false, bool writeUnicodeHeaderBytes=false, const char *lineEndings="\") const
Replaces this file's contents with a given text string.
void * getData() const noexcept
Returns the address at which this file has been mapped, or a null pointer if the file couldn't be suc...
static bool isDigit(char character) noexcept
Checks whether a character is a digit.
CharPointerType getCharPointer() const noexcept
Returns the character pointer currently being used to store this string.
String dropLastCharacters(int numberToDrop) const
Returns a version of this string with a number of characters removed from the end.
int addLines(StringRef stringToBreakUp)
Breaks up a string into lines and adds them to this array.
bool operator==(const File &) const
Compares the pathnames for two files.
bool isRoot() const
Checks whether the path of this file represents the root of a file system, irrespective of its existe...
bool containsSubDirectories() const
Returns true if this file is a directory that contains one or more subdirectories.
int64 toMilliseconds() const noexcept
Returns the time as a number of milliseconds.
bool isSymbolicLink() const
Returns true if this file is a link or alias that can be followed using getLinkedTarget().
A special array for holding a list of strings.
File getChildFile(StringRef relativeOrAbsolutePath) const
Returns a file that represents a relative (or absolute) sub-path of the current one.
FileInputStream * createInputStream() const
Creates a stream to read from this file.
Use this flag to indicate that you want to find both files and directories.
bool write(const void *, size_t) override
Writes a block of data to the stream.
static Time JUCE_CALLTYPE getCurrentTime() noexcept
Returns a Time object that is set to the current system time.
File & operator=(const String &newAbsolutePath)
Sets the file based on an absolute pathname.
static bool JUCE_CALLTYPE openDocument(const String &documentURL, const String ¶meters)
Tries to launch the OS's default reader application for a given file or URL.
bool exists() const
Checks whether the file actually exists.
const wchar_t * toWideCharPointer() const
Returns a pointer to a wchar_t version of this string.
bool setLastModificationTime(Time newTime) const
Changes the modification time for this file.
Time getLastAccessTime() const
Returns the last time this file was accessed.
bool replaceFileIn(const File &targetLocation) const
Replaces a file.
static void findFileSystemRoots(Array< File > &results)
Creates a set of files to represent each file root.
static String createLegalFileName(const String &fileNameToFix)
Returns a version of a filename with any illegal characters removed.
void readLines(StringArray &destLines) const
Reads the contents of this file as text and splits it into lines, which are appended to the given Str...
This is a base class for classes that perform a unit test.
static Result fail(const String &errorMessage) noexcept
Creates a 'failure' result.
Maps a file into virtual memory for easy reading and/or writing.
virtual bool writeText(const String &text, bool asUTF16, bool writeUTF16ByteOrderMark, const char *lineEndings)
Writes a string of text to the stream.
String removeCharacters(StringRef charactersToRemove) const
Returns a version of this string with a set of characters removed.
int addTokens(StringRef stringToTokenise, bool preserveQuotedStrings)
Breaks up a string into tokens and adds them to this array.
String trimEnd() const
Returns a copy of this string with any whitespace characters removed from the end.
static String repeatedString(StringRef stringToRepeat, int numberOfTimesToRepeat)
Creates a string which is a version of a string repeated and joined together.
Returns this application's executable file.
String substring(int startIndex, int endIndex) const
Returns a subsection of the string.
Use this flag to indicate that you want to find files.
static String descriptionOfSizeInBytes(int64 bytes)
Utility function to convert a file size in bytes to a neat string description.
File withFileExtension(StringRef newExtension) const
Returns a version of this file with a different file extension.
int indexOf(const CharPointer stringToFind) const noexcept
Returns the character index of a substring, or -1 if it isn't found.
String loadFileAsString() const
Reads a file into memory as a string.
bool contains(StringRef text) const noexcept
Tests whether the string contains another substring.
int64 getSize() const
Returns the size of the file in bytes.
int64 hashCode64() const
Returns a 64-bit hash-code that identifies this file.
int compareIgnoreCase(const String &other) const noexcept
Case-insensitive comparison with another string.
bool isHidden() const
Returns true if this file is a hidden or system file.
bool isEmpty() const noexcept
Returns true if the string is empty.
juce_wchar getAndAdvance() noexcept
Returns the character that this pointer is currently pointing to, and then advances the pointer to po...
static String toHexString(IntegerType number)
Returns a string representing this numeric value in hexadecimal.
bool loadFileAsData(MemoryBlock &result) const
Loads a file's contents into memory as a block of binary data.
Represents the 'success' or 'failure' of an operation, and holds an associated error message to descr...
bool replaceWithData(const void *dataToWrite, size_t numberOfBytes) const
Replaces this file's contents with a given block of data.
Array< File > findChildFiles(int whatToLookFor, bool searchRecursively, const String &wildCardPattern="*") const
Searches this directory for files matching a wildcard pattern.
void removeRange(int startIndex, int numberToRemove)
Removes a range of elements from the array.
bool existsAsFile() const
Checks whether the file exists and is a file rather than a directory.
String getRelativePathFrom(const File &directoryToBeRelativeTo) const
Creates a relative path that refers to a file relatively to a given directory.
String replaceCharacter(juce_wchar characterToReplace, juce_wchar characterToInsertInstead) const
Returns a string with all occurrences of a character replaced with a different one.
Use this flag to indicate that you want to find directories.
Represents a local file or directory.
bool moveFileTo(const File &targetLocation) const
Moves or renames a file.
Holds a resizable array of primitive or copy-by-value objects.
bool hasFileExtension(StringRef extensionToTest) const
Checks whether the file has a given extension.
String getFileExtension() const
Returns the file's extension.
int size() const noexcept
Returns the current number of elements in the array.
FileOutputStream * createOutputStream(size_t bufferSize=0x8000) const
Creates a stream to write to this file.
static juce_wchar toLowerCase(juce_wchar character) noexcept
Converts a character to lower-case.
bool isEmpty() const noexcept
Returns true if the string contains no characters.
String::CharPointerType text
The text that is referenced.
String joinIntoString(StringRef separatorString, int startIndex=0, int numberOfElements=-1) const
Joins the strings in the array together into one string.
String upToFirstOccurrenceOf(StringRef substringToEndWith, bool includeSubStringInResult, bool ignoreCase) const
Returns the start of this string, up to the first occurrence of a substring.
bool setExecutePermission(bool shouldBeExecutable) const
Changes the execute-permissions of a file.
File getNonexistentChildFile(const String &prefix, const String &suffix, bool putNumbersInBrackets=true) const
Chooses a filename relative to this one that doesn't already exist.
static String addTrailingSeparator(const String &path)
Adds a separator character to the end of a path if it doesn't already have one.
static void JUCE_CALLTYPE writeToLog(const String &message)
Writes a string to the current logger.
int64 getVolumeTotalSize() const
Returns the total size of the drive that contains this file.
bool startsWithChar(juce_wchar character) const noexcept
Tests whether the string begins with a particular character.
Time getCreationTime() const
Returns the time that this file was created.
int64 getBytesFreeOnVolume() const
Returns the number of bytes free on the drive that this file lives on.
An output stream that writes into a local file.
String getFileNameWithoutExtension() const
Returns the last part of the filename, without its file extension.
The folder in which applications store their persistent user-specific settings.
bool openedOk() const noexcept
Returns true if the stream opened without problems.
static StringRef getSeparatorString()
The system-specific file separator character, as a string.
int hashCode() const noexcept
Generates a probably-unique 32-bit hashcode from this string.
bool isOnCDRomDrive() const
Returns true if this file is on a CD or DVD drive.
static File createTempFile(StringRef fileNameEnding)
Returns a temporary file in the system's temp directory.
static bool areFileNamesCaseSensitive()
Indicates whether filenames are case-sensitive on the current operating system.
int lastIndexOfChar(juce_wchar character) const noexcept
Searches for a character inside this string (working backwards from the end of the string)...
int size() const noexcept
Returns the number of strings in the array.
AccessMode
The read/write flags used when opening a memory mapped file.
int hashCode() const
Returns a 32-bit hash-code that identifies this file.
bool startAsProcess(const String ¶meters=String()) const
Launches the file as a process.
bool operator>(const File &) const
Compares the pathnames for two files.
bool isDirectory() const
Checks whether the file is a directory that exists.
String getNativeLinkedTarget() const
This returns the native path that the symbolic link points to.
int indexOfChar(juce_wchar characterToLookFor) const noexcept
Searches for a character inside this string.
int compare(const String &other) const noexcept
Case-sensitive comparison with another string.
static File getCurrentWorkingDirectory()
Returns the current working directory.
File()=default
Creates an (invalid) file object.
int length() const noexcept
Returns the number of characters in the string.
bool failedToOpen() const noexcept
Returns true if the stream couldn't be opened for some reason.
A class to hold a resizable block of raw data.
Holds an absolute date and time.
size_t getSize() const noexcept
Returns the number of bytes of data that are available for reading or writing.
static File JUCE_CALLTYPE getSpecialLocation(const SpecialLocationType type)
Finds the location of a special type of file or directory, such as a home folder or documents folder...
MemoryMappedFile(const File &file, AccessMode mode, bool exclusive=false)
Opens a file and maps it to an area of virtual memory.
File getNonexistentSibling(bool putNumbersInBrackets=true) const
Chooses a filename for a sibling file to this one that doesn't already exist.
File getLinkedTarget() const
If this file is a link or alias, this returns the file that it points to.
bool next()
Moves the iterator along to the next file.
bool isOnHardDisk() const
Returns true if this file is on a hard disk.
const String & getFullPathName() const noexcept
Returns the complete, absolute path of this file.
int getNumberOfChildFiles(int whatToLookFor, const String &wildCardPattern="*") const
Searches inside a directory and counts how many files match a wildcard pattern.
void appendCharPointer(CharPointerType startOfTextToAppend, CharPointerType endOfTextToAppend)
Appends a string to the end of this one.
bool setAsCurrentWorkingDirectory() const
Sets the current working directory to be this file.
bool deleteRecursively(bool followSymlinks=false) const
Deletes a file or directory and all its subdirectories.
bool startsWith(StringRef text) const noexcept
Tests whether the string begins with another string.
Returns the file that was invoked to launch this executable.
Returns this application's location.
static juce_wchar getSeparatorChar()
The system-specific file separator character.
Wraps a pointer to a null-terminated UTF-8 character string, and provides various methods to operate ...
The folder that should be used for temporary files.