26#if ! DOXYGEN && (JUCE_MAC || JUCE_IOS)
85 File& operator= (
const String& newAbsolutePath);
88 File& operator= (
const File& otherFile);
110 bool existsAsFile() const;
118 bool isDirectory() const;
132 int64 getSize() const;
139 static
String descriptionOfSizeInBytes (
int64 bytes);
153 const
String& getFullPathName() const noexcept {
return fullPath; }
168 String getFileName()
const;
185 String getRelativePathFrom (
const File& directoryToBeRelativeTo)
const;
196 String getFileExtension()
const;
209 bool hasFileExtension (
StringRef extensionToTest)
const;
229 String getFileNameWithoutExtension()
const;
237 int hashCode()
const;
244 int64 hashCode64()
const;
279 File getParentDirectory()
const;
290 bool isAChildOf (
const File& potentialParentDirectory)
const;
310 File getNonexistentChildFile (
const String& prefix,
312 bool putNumbersInBrackets =
true)
const;
323 File getNonexistentSibling (
bool putNumbersInBrackets =
true)
const;
327 bool operator== (
const File&)
const;
329 bool operator!= (
const File&)
const;
331 bool operator< (
const File&)
const;
333 bool operator> (
const File&)
const;
343 bool hasWriteAccess()
const;
349 bool hasReadAccess()
const;
360 bool setReadOnly (
bool shouldBeReadOnly,
361 bool applyRecursively =
false)
const;
368 bool setExecutePermission (
bool shouldBeExecutable)
const;
373 bool isHidden()
const;
381 uint64 getFileIdentifier()
const;
389 Time getLastModificationTime()
const;
396 Time getLastAccessTime()
const;
403 Time getCreationTime()
const;
411 bool setLastModificationTime (
Time newTime)
const;
419 bool setLastAccessTime (
Time newTime)
const;
427 bool setCreationTime (
Time newTime)
const;
435 String getVersion()
const;
463 Result createDirectory()
const;
477 bool deleteFile()
const;
491 bool deleteRecursively (
bool followSymlinks =
false)
const;
499 bool moveToTrash()
const;
519 bool moveFileTo (
const File& targetLocation)
const;
531 bool copyFileTo (
const File& targetLocation)
const;
543 bool replaceFileIn (
const File& targetLocation)
const;
558 bool copyDirectoryTo (
const File& newDirectory)
const;
567 findFilesAndDirectories = 3,
568 ignoreHiddenFiles = 4
606 bool searchRecursively,
607 const String& wildCardPattern =
"*",
608 FollowSymlinks followSymlinks = FollowSymlinks::yes)
const;
615 int findChildFiles (
Array<File>& results,
int whatToLookFor,
616 bool searchRecursively,
const String& wildCardPattern =
"*",
617 FollowSymlinks followSymlinks = FollowSymlinks::yes)
const;
636 int getNumberOfChildFiles (
int whatToLookFor,
637 const String& wildCardPattern =
"*")
const;
642 bool containsSubDirectories()
const;
717 String loadFileAsString()
const;
731 bool appendData (
const void* dataToAppend,
732 size_t numberOfBytes)
const;
748 bool replaceWithData (
const void* dataToWrite,
749 size_t numberOfBytes)
const;
764 bool appendText (
const String& textToAppend,
765 bool asUnicode =
false,
766 bool writeUnicodeHeaderBytes =
false,
767 const char* lineEndings =
"\r\n")
const;
785 bool replaceWithText (
const String& textToWrite,
786 bool asUnicode =
false,
787 bool writeUnicodeHeaderBytes =
false,
788 const char* lineEndings =
"\r\n")
const;
793 bool hasIdenticalContentTo (
const File& other)
const;
802 static void findFileSystemRoots (
Array<File>& results);
807 String getVolumeLabel()
const;
812 int getVolumeSerialNumber()
const;
819 int64 getBytesFreeOnVolume()
const;
826 int64 getVolumeTotalSize()
const;
829 bool isOnCDRomDrive()
const;
836 bool isOnHardDisk()
const;
842 bool isOnRemovableDrive()
const;
856 bool startAsProcess (
const String& parameters =
String())
const;
861 void revealToUser()
const;
954 #if JUCE_WINDOWS || DOXYGEN
965 #if JUCE_WINDOWS || DOXYGEN
998 static File getCurrentWorkingDirectory();
1007 bool setAsCurrentWorkingDirectory()
const;
1032 static String createLegalFileName (
const String& fileNameToFix);
1041 static String createLegalPathName (
const String& pathNameToFix);
1044 static bool areFileNamesCaseSensitive();
1047 static bool isAbsolutePath (
StringRef path);
1054 static File createFileWithoutCheckingPath (
const String& absolutePath)
noexcept;
1057 static String addTrailingSeparator (
const String& path);
1061 bool createSymbolicLink (
const File& linkFileToCreate,
bool overwriteExisting)
const;
1064 bool isSymbolicLink()
const;
1069 File getLinkedTarget()
const;
1076 static bool createSymbolicLink (
const File& linkFileToCreate,
1077 const String& nativePathOfTarget,
1078 bool overwriteExisting);
1082 String getNativeLinkedTarget()
const;
1084 #if JUCE_WINDOWS || DOXYGEN
1095 #if JUCE_MAC || JUCE_IOS || DOXYGEN
1103 #if JUCE_MAC || DOXYGEN
1108 #if JUCE_MAC || JUCE_IOS
1116 static File getContainerForSecurityApplicationGroupIdentifier (
const String& appGroup);
1123 NaturalFileComparator (
bool shouldPutFoldersFirst) noexcept : foldersFirst (shouldPutFoldersFirst) {}
1125 int compareElements (
const File& firstFile,
const File& secondFile)
const
1130 #if NAMES_ARE_CASE_SENSITIVE
1140 #if JUCE_ALLOW_STATIC_NULL_VARIABLES && ! defined (DOXYGEN)
1146 [[deprecated]]
static const juce_wchar separator;
1147 [[deprecated]]
static const StringRef separatorString;
1148 [[deprecated]]
static const File nonexistent;
1156 String getPathUpToLastSlash()
const;
1157 bool isNonEmptyDirectory()
const;
1160 bool copyInternal (
const File&)
const;
1161 bool moveInternal (
const File&)
const;
1162 bool replaceInternal (
const File&)
const;
1165 bool setFileReadOnlyInternal (
bool)
const;
1166 bool setFileExecutableInternal (
bool)
const;
Holds a resizable array of primitive or copy-by-value objects.
Represents a local file or directory.
bool isDirectory() const
Checks whether the file is a directory that exists.
OSType getMacOSType() const
OSX ONLY - Finds the OSType of a file from the its resources.
const String & getFullPathName() const noexcept
Returns the complete, absolute path of this file.
~File()=default
Destructor.
SpecialLocationType
A set of types of location that can be passed to the getSpecialLocation() method.
@ userMoviesDirectory
The most likely place where a user might store their movie files.
@ userMusicDirectory
The most likely place where a user might store their music files.
@ tempDirectory
The folder that should be used for temporary files.
@ globalApplicationsDirectory
The directory in which applications normally get installed.
@ userDocumentsDirectory
The user's default documents folder.
@ globalApplicationsDirectoryX86
On a Windows machine, returns the directory in which 32 bit applications normally get installed.
@ currentApplicationFile
Returns this application's location.
@ invokedExecutableFile
Returns the file that was invoked to launch this executable.
@ commonDocumentsDirectory
A place to put documents which are shared by all users of the machine.
@ userApplicationDataDirectory
The folder in which applications store their persistent user-specific settings.
@ userPicturesDirectory
The most likely place where a user might store their picture files.
@ commonApplicationDataDirectory
An equivalent of the userApplicationDataDirectory folder that is shared by all users of the computer,...
@ windowsSystemDirectory
On a Windows machine, returns the location of the Windows/System32 folder.
@ userDesktopDirectory
The folder that contains the user's desktop objects.
@ hostApplicationPath
In a plugin, this will return the path of the host executable.
@ currentExecutableFile
Returns this application's executable file.
@ userHomeDirectory
The user's home folder.
TypesOfFileToFind
Used in file searching, to specify whether to return files, directories, or both.
bool isShortcut() const
Windows ONLY - Returns true if this is a win32 .LNK file.
void addToDock() const
OSX ONLY - Adds this file to the OSX dock.
bool isBundle() const
OSX ONLY - Returns true if this file is actually a bundle.
File()=default
Creates an (invalid) file object.
bool createShortcut(const String &description, const File &linkFileToCreate) const
Windows ONLY - Creates a win32 .LNK shortcut file that links to this file.
A class to hold a resizable block of raw data.
Represents the 'success' or 'failure' of an operation, and holds an associated error message to descr...
A special array for holding a list of strings.
A simple class for holding temporary references to a string literal or String.
int compareNatural(StringRef other, bool isCaseSensitive=false) const noexcept
Compares two strings, taking into account textual characteristics like numbers and spaces.
Holds an absolute date and time.
wchar_t juce_wchar
A platform-independent 32-bit unicode character type.
unsigned long long uint64
A platform-independent 64-bit unsigned integer type.
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...
long long int64
A platform-independent 64-bit integer type.