mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-19 01:04:20 +00:00
Introjucer: Added Android Studio exporter
This commit is contained in:
parent
ddcd78eae8
commit
810f2bfb2a
40 changed files with 2257 additions and 376 deletions
|
|
@ -886,6 +886,41 @@ File File::createTempFile (StringRef fileNameEnding)
|
|||
return tempFile;
|
||||
}
|
||||
|
||||
bool File::createSymbolicLink (const File& linkFileToCreate, bool overwriteExisting) const
|
||||
{
|
||||
if (linkFileToCreate.exists())
|
||||
{
|
||||
if (! linkFileToCreate.isSymbolicLink())
|
||||
{
|
||||
// user has specified an existing file / directory as the link
|
||||
// this is bad! the user could end up unintentionally destroying data
|
||||
jassertfalse;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (overwriteExisting)
|
||||
linkFileToCreate.deleteFile();
|
||||
}
|
||||
|
||||
#if JUCE_MAC || JUCE_LINUX
|
||||
// one common reason for getting an error here is that the file already exists
|
||||
if (symlink (fullPath.toRawUTF8(), linkFileToCreate.getFullPathName().toRawUTF8()) == -1)
|
||||
{
|
||||
jassertfalse;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
#elif JUCE_WINDOWS
|
||||
return CreateSymbolicLink (linkFileToCreate.getFullPathName().toWideCharPointer(),
|
||||
fullPath.toWideCharPointer(),
|
||||
isDirectory() ? SYMBOLIC_LINK_FLAG_DIRECTORY : 0) != FALSE;
|
||||
#else
|
||||
jassertfalse; // symbolic links not supported on this platform!
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
MemoryMappedFile::MemoryMappedFile (const File& file, MemoryMappedFile::AccessMode mode)
|
||||
: address (nullptr), range (0, file.getSize()), fileHandle (0)
|
||||
|
|
|
|||
|
|
@ -360,14 +360,6 @@ public:
|
|||
*/
|
||||
bool isHidden() const;
|
||||
|
||||
/** Returns true if this file is a link or alias that can be followed using getLinkedTarget(). */
|
||||
bool isLink() const;
|
||||
|
||||
/** If this file is a link or alias, this returns the file that it points to.
|
||||
If the file isn't actually link, it'll just return itself.
|
||||
*/
|
||||
File getLinkedTarget() const;
|
||||
|
||||
/** Returns a unique identifier for the file, if one is available.
|
||||
|
||||
Depending on the OS and file-system, this may be a unix inode number or
|
||||
|
|
@ -880,7 +872,6 @@ public:
|
|||
*/
|
||||
static File createTempFile (StringRef fileNameEnding);
|
||||
|
||||
|
||||
//==============================================================================
|
||||
/** Returns the current working directory.
|
||||
@see setAsCurrentWorkingDirectory
|
||||
|
|
@ -946,8 +937,28 @@ public:
|
|||
/** Adds a separator character to the end of a path if it doesn't already have one. */
|
||||
static String addTrailingSeparator (const String& path);
|
||||
|
||||
#if JUCE_MAC || JUCE_IOS || DOXYGEN
|
||||
//==============================================================================
|
||||
/** Tries to create a symbolic link and returns a boolean to indicate success */
|
||||
bool createSymbolicLink (const File& linkFileToCreate, bool overwriteExisting) const;
|
||||
|
||||
/** Returns true if this file is a link or alias that can be followed using getLinkedTarget(). */
|
||||
bool isSymbolicLink() const;
|
||||
|
||||
/** If this file is a link or alias, this returns the file that it points to.
|
||||
If the file isn't actually link, it'll just return itself.
|
||||
*/
|
||||
File getLinkedTarget() const;
|
||||
|
||||
#if JUCE_WINDOWS
|
||||
/** Windows ONLY - Creates a win32 .LNK shortcut file that links to this file. */
|
||||
bool createShortcut (const String& description, const File& linkFileToCreate) const;
|
||||
|
||||
/** Windows ONLY - Returns true if this is a win32 .LNK file. */
|
||||
bool isShortcut() const;
|
||||
#endif
|
||||
|
||||
//==============================================================================
|
||||
#if JUCE_MAC || JUCE_IOS || DOXYGEN
|
||||
/** OSX ONLY - Finds the OSType of a file from the its resources. */
|
||||
OSType getMacOSType() const;
|
||||
|
||||
|
|
@ -960,11 +971,6 @@ public:
|
|||
void addToDock() const;
|
||||
#endif
|
||||
|
||||
#if JUCE_WINDOWS
|
||||
/** Windows ONLY - Creates a win32 .LNK shortcut file that links to this file. */
|
||||
bool createLink (const String& description, const File& linkFileToCreate) const;
|
||||
#endif
|
||||
|
||||
private:
|
||||
//==============================================================================
|
||||
String fullPath;
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ static String getLinkedFile (const String& file)
|
|||
return String::fromUTF8 (buffer, jmax (0, numBytes));
|
||||
};
|
||||
|
||||
bool File::isLink() const
|
||||
bool File::isSymbolicLink() const
|
||||
{
|
||||
return getLinkedFile (getFullPathName()).isNotEmpty();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -285,7 +285,7 @@ static NSString* getFileLink (const String& path)
|
|||
#endif
|
||||
}
|
||||
|
||||
bool File::isLink() const
|
||||
bool File::isSymbolicLink() const
|
||||
{
|
||||
return getFileLink (fullPath) != nil;
|
||||
}
|
||||
|
|
@ -401,7 +401,12 @@ bool JUCE_CALLTYPE Process::openDocument (const String& fileName, const String&
|
|||
{
|
||||
JUCE_AUTORELEASEPOOL
|
||||
{
|
||||
NSURL* filenameAsURL = [NSURL URLWithString: juceStringToNS (fileName)];
|
||||
NSString* fileNameAsNS (juceStringToNS (fileName));
|
||||
|
||||
NSURL* filenameAsURL ([NSURL URLWithString: fileNameAsNS]);
|
||||
|
||||
if (filenameAsURL == nil)
|
||||
filenameAsURL = [NSURL fileURLWithPath: fileNameAsNS];
|
||||
|
||||
#if JUCE_IOS
|
||||
(void) parameters;
|
||||
|
|
|
|||
|
|
@ -631,13 +631,45 @@ String File::getVersion() const
|
|||
}
|
||||
|
||||
//==============================================================================
|
||||
bool File::isLink() const
|
||||
bool File::isSymbolicLink() const
|
||||
{
|
||||
return (GetFileAttributes (fullPath.toWideCharPointer()) & FILE_ATTRIBUTE_REPARSE_POINT) != 0;
|
||||
}
|
||||
|
||||
bool File::isShortcut() const
|
||||
{
|
||||
return hasFileExtension (".lnk");
|
||||
}
|
||||
|
||||
File File::getLinkedTarget() const
|
||||
{
|
||||
{
|
||||
HANDLE h = CreateFile (getFullPathName().toWideCharPointer(),
|
||||
GENERIC_READ, FILE_SHARE_READ, nullptr,
|
||||
OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0);
|
||||
|
||||
if (h != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
DWORD requiredSize = ::GetFinalPathNameByHandleW (h, nullptr, 0, FILE_NAME_NORMALIZED);
|
||||
|
||||
if (requiredSize > 0)
|
||||
{
|
||||
HeapBlock<WCHAR> buffer (requiredSize + 2);
|
||||
buffer.clear (requiredSize + 2);
|
||||
|
||||
requiredSize = ::GetFinalPathNameByHandleW (h, buffer, requiredSize, FILE_NAME_NORMALIZED);
|
||||
|
||||
if (requiredSize > 0)
|
||||
{
|
||||
CloseHandle (h);
|
||||
return File (String (buffer));
|
||||
}
|
||||
}
|
||||
|
||||
CloseHandle (h);
|
||||
}
|
||||
}
|
||||
|
||||
File result (*this);
|
||||
String p (getFullPathName());
|
||||
|
||||
|
|
@ -664,7 +696,7 @@ File File::getLinkedTarget() const
|
|||
return result;
|
||||
}
|
||||
|
||||
bool File::createLink (const String& description, const File& linkFileToCreate) const
|
||||
bool File::createShortcut (const String& description, const File& linkFileToCreate) const
|
||||
{
|
||||
linkFileToCreate.deleteFile();
|
||||
|
||||
|
|
|
|||
|
|
@ -173,6 +173,12 @@ void StringArray::addArray (const StringArray& otherArray, int startIndex, int n
|
|||
strings.add (otherArray.strings.getReference (startIndex++));
|
||||
}
|
||||
|
||||
void StringArray::mergeArray (const StringArray& otherArray, const bool ignoreCase)
|
||||
{
|
||||
for (int i = 0; i < otherArray.size(); ++i)
|
||||
addIfNotAlreadyThere (otherArray[i], ignoreCase);
|
||||
}
|
||||
|
||||
void StringArray::set (const int index, const String& newString)
|
||||
{
|
||||
strings.set (index, newString);
|
||||
|
|
|
|||
|
|
@ -209,6 +209,15 @@ public:
|
|||
int startIndex = 0,
|
||||
int numElementsToAdd = -1);
|
||||
|
||||
/** Merges the strings from another array into this one.
|
||||
This will not add a string that already exists.
|
||||
|
||||
@param other the array to add
|
||||
@param ignoreCase ignore case when merging
|
||||
*/
|
||||
void mergeArray (const StringArray& other,
|
||||
bool ignoreCase = false);
|
||||
|
||||
/** Breaks up a string into tokens and adds them to this array.
|
||||
|
||||
This will tokenise the given string using whitespace characters as the
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue