@@ -71,8 +71,8 @@ static bool canFileBeReincluded (const File& f) | |||||
//============================================================================== | //============================================================================== | ||||
static bool parseFile (const File& rootFolder, | static bool parseFile (const File& rootFolder, | ||||
const File& newTargetFile, | const File& newTargetFile, | ||||
StringArray& dest, | |||||
const File& file, | |||||
StringArray& dest, | |||||
const File& file, | |||||
StringArray& alreadyIncludedFiles, | StringArray& alreadyIncludedFiles, | ||||
const StringArray& includesToIgnore, | const StringArray& includesToIgnore, | ||||
const StringArray& wildcards, | const StringArray& wildcards, | ||||
@@ -133,18 +133,18 @@ static bool parseFile (const File& rootFolder, | |||||
alreadyIncludedFiles.add (targetFile.getFullPathName()); | alreadyIncludedFiles.add (targetFile.getFullPathName()); | ||||
dest.add (String::empty); | dest.add (String::empty); | ||||
dest.add (T("/********* Start of inlined file: ") | |||||
dest.add (T("/********* Start of inlined file: ") | |||||
+ targetFile.getFileName() | + targetFile.getFileName() | ||||
+ T(" *********/")); | + T(" *********/")); | ||||
if (! parseFile (rootFolder, newTargetFile, | |||||
if (! parseFile (rootFolder, newTargetFile, | |||||
dest, targetFile, alreadyIncludedFiles, includesToIgnore, | dest, targetFile, alreadyIncludedFiles, includesToIgnore, | ||||
wildcards, false, stripUnnecessaryStuff)) | wildcards, false, stripUnnecessaryStuff)) | ||||
{ | { | ||||
return false; | return false; | ||||
} | } | ||||
dest.add (T("/********* End of inlined file: ") | |||||
dest.add (T("/********* End of inlined file: ") | |||||
+ targetFile.getFileName() | + targetFile.getFileName() | ||||
+ T(" *********/")); | + T(" *********/")); | ||||
dest.add (String::empty); | dest.add (String::empty); | ||||
@@ -192,9 +192,9 @@ static bool munge (const File& templateFile, const File& targetFile, const Strin | |||||
wildcards.trim(); | wildcards.trim(); | ||||
wildcards.removeEmptyStrings(); | wildcards.removeEmptyStrings(); | ||||
if (! parseFile (targetFile.getParentDirectory(), | |||||
if (! parseFile (targetFile.getParentDirectory(), | |||||
targetFile, | targetFile, | ||||
lines, templateFile, | |||||
lines, templateFile, | |||||
alreadyIncludedFiles, | alreadyIncludedFiles, | ||||
includesToIgnore, | includesToIgnore, | ||||
wildcards, | wildcards, | ||||
@@ -296,7 +296,7 @@ static void mungeJuce (const File& juceFolder) | |||||
//============================================================================== | //============================================================================== | ||||
int main (int argc, char* argv[]) | int main (int argc, char* argv[]) | ||||
{ | { | ||||
// If you're running a command-line app, you need to initialise juce manually | |||||
// If you're running a command-line app, you need to initialise juce manually | |||||
// before calling any Juce functionality.. | // before calling any Juce functionality.. | ||||
initialiseJuce_NonGUI(); | initialiseJuce_NonGUI(); | ||||
@@ -327,10 +327,9 @@ int main (int argc, char* argv[]) | |||||
" ignoring any repeated instances of it.\n\n" | " ignoring any repeated instances of it.\n\n" | ||||
" The wildcard lets you specify what kind of files will be replaced, so\n" | " The wildcard lets you specify what kind of files will be replaced, so\n" | ||||
" \"*.cpp;*.h\" would replace only includes that reference a .cpp or .h file.\n\n" | " \"*.cpp;*.h\" would replace only includes that reference a .cpp or .h file.\n\n" | ||||
" Or: just run 'amalgamator YourJuceDirectory' to rebuild the juce files." | |||||
" Or: just run 'amalgamator YourJuceDirectory' to rebuild the juce files." | |||||
); | ); | ||||
} | } | ||||
return 0; | return 0; | ||||
} | } | ||||
@@ -1,5 +1,5 @@ | |||||
/* | /* | ||||
This file contains settings that you might want to explicitly apply to | |||||
This file contains settings that you might want to explicitly apply to | |||||
your Juce build. | your Juce build. | ||||
These flags enable or disable juce features - if you're linking to juce as | These flags enable or disable juce features - if you're linking to juce as | ||||
@@ -8,7 +8,7 @@ | |||||
just include this file before including your juce_amalgamated.cpp file to | just include this file before including your juce_amalgamated.cpp file to | ||||
have the same effect. | have the same effect. | ||||
If you leave any of these commented-out, they'll take on the default value | |||||
If you leave any of these commented-out, they'll take on the default value | |||||
assigned to them in juce_Config.h, so to force them on or off, just set them | assigned to them in juce_Config.h, so to force them on or off, just set them | ||||
to an explicit 0 or 1 in here. | to an explicit 0 or 1 in here. | ||||
*/ | */ | ||||
@@ -1,10 +1,10 @@ | |||||
/* | |||||
/* | |||||
This file includes the entire juce source tree via the amalgamated file. | This file includes the entire juce source tree via the amalgamated file. | ||||
You could add the amalgamated file directly to your project, but doing it | You could add the amalgamated file directly to your project, but doing it | ||||
like this allows you to put your app's config settings in the | |||||
juce_AppConfig.h file and have them applied to both the juce headers and | |||||
like this allows you to put your app's config settings in the | |||||
juce_AppConfig.h file and have them applied to both the juce headers and | |||||
the source code. | the source code. | ||||
*/ | */ | ||||
@@ -1,10 +1,10 @@ | |||||
/* | |||||
/* | |||||
This file includes the entire juce source tree via the amalgamated file. | This file includes the entire juce source tree via the amalgamated file. | ||||
You could add the amalgamated file directly to your project, but doing it | You could add the amalgamated file directly to your project, but doing it | ||||
like this allows you to put your app's config settings in the | |||||
juce_AppConfig.h file and have them applied to both the juce headers and | |||||
like this allows you to put your app's config settings in the | |||||
juce_AppConfig.h file and have them applied to both the juce headers and | |||||
the source code. | the source code. | ||||
*/ | */ | ||||
@@ -45,7 +45,7 @@ public: | |||||
void prepareToPlay (double sampleRate, int samplesPerBlock); | void prepareToPlay (double sampleRate, int samplesPerBlock); | ||||
void releaseResources(); | void releaseResources(); | ||||
void processBlock (AudioSampleBuffer& buffer, | |||||
void processBlock (AudioSampleBuffer& buffer, | |||||
MidiBuffer& midiMessages); | MidiBuffer& midiMessages); | ||||
//============================================================================== | //============================================================================== | ||||
@@ -17,7 +17,7 @@ | |||||
//============================================================================== | //============================================================================== | ||||
static int addFile (const File& file, | static int addFile (const File& file, | ||||
const String& classname, | |||||
const String& classname, | |||||
OutputStream& headerStream, | OutputStream& headerStream, | ||||
OutputStream& cppStream) | OutputStream& cppStream) | ||||
{ | { | ||||
@@ -29,7 +29,7 @@ static int addFile (const File& file, | |||||
.replaceCharacter ('.', '_') | .replaceCharacter ('.', '_') | ||||
.retainCharacters (T("abcdefghijklmnopqrstuvwxyz_0123456789"))); | .retainCharacters (T("abcdefghijklmnopqrstuvwxyz_0123456789"))); | ||||
printf ("Adding %s: %d bytes\n", | |||||
printf ("Adding %s: %d bytes\n", | |||||
(const char*) name, | (const char*) name, | ||||
mb.getSize()); | mb.getSize()); | ||||
@@ -59,8 +59,8 @@ static int addFile (const File& file, | |||||
cppStream.printf ("%d,0,0};\r\n", (int) data[i]); | cppStream.printf ("%d,0,0};\r\n", (int) data[i]); | ||||
cppStream.printf ("const char* %s::%s = (const char*) temp%d;\r\n\r\n", | cppStream.printf ("const char* %s::%s = (const char*) temp%d;\r\n\r\n", | ||||
(const char*) classname, | |||||
(const char*) name, | |||||
(const char*) classname, | |||||
(const char*) name, | |||||
tempNum); | tempNum); | ||||
return mb.getSize(); | return mb.getSize(); | ||||
@@ -78,7 +78,7 @@ static bool isHiddenFile (const File& f, const File& root) | |||||
//============================================================================== | //============================================================================== | ||||
int main (int argc, char* argv[]) | int main (int argc, char* argv[]) | ||||
{ | { | ||||
// If you're running a command-line app, you need to initialise juce manually | |||||
// If you're running a command-line app, you need to initialise juce manually | |||||
// before calling any Juce functionality.. | // before calling any Juce functionality.. | ||||
initialiseJuce_NonGUI(); | initialiseJuce_NonGUI(); | ||||
@@ -128,15 +128,15 @@ int main (int argc, char* argv[]) | |||||
const File cppFile (destDirectory.getChildFile (className).withFileExtension (T(".cpp"))); | const File cppFile (destDirectory.getChildFile (className).withFileExtension (T(".cpp"))); | ||||
String message; | String message; | ||||
message << "Creating " << headerFile.getFullPathName() | |||||
message << "Creating " << headerFile.getFullPathName() | |||||
<< " and " << cppFile.getFullPathName() | << " and " << cppFile.getFullPathName() | ||||
<< " from files in " << sourceDirectory.getFullPathName() | |||||
<< " from files in " << sourceDirectory.getFullPathName() | |||||
<< "...\n\n"; | << "...\n\n"; | ||||
printf ((const char*) message); | printf ((const char*) message); | ||||
OwnedArray <File> files; | OwnedArray <File> files; | ||||
sourceDirectory.findChildFiles (files, File::findFiles, true, | |||||
sourceDirectory.findChildFiles (files, File::findFiles, true, | |||||
(argc > 4) ? argv[4] : "*"); | (argc > 4) ? argv[4] : "*"); | ||||
if (files.size() == 0) | if (files.size() == 0) | ||||
@@ -1,5 +1,5 @@ | |||||
/* | /* | ||||
This file contains settings that you might want to explicitly apply to | |||||
This file contains settings that you might want to explicitly apply to | |||||
your Juce build. | your Juce build. | ||||
These flags enable or disable juce features - if you're linking to juce as | These flags enable or disable juce features - if you're linking to juce as | ||||
@@ -8,7 +8,7 @@ | |||||
just include this file before including your juce_amalgamated.cpp file to | just include this file before including your juce_amalgamated.cpp file to | ||||
have the same effect. | have the same effect. | ||||
If you leave any of these commented-out, they'll take on the default value | |||||
If you leave any of these commented-out, they'll take on the default value | |||||
assigned to them in juce_Config.h, so to force them on or off, just set them | assigned to them in juce_Config.h, so to force them on or off, just set them | ||||
to an explicit 0 or 1 in here. | to an explicit 0 or 1 in here. | ||||
*/ | */ | ||||
@@ -1,10 +1,10 @@ | |||||
/* | |||||
/* | |||||
This file includes the entire juce source tree via the amalgamated file. | This file includes the entire juce source tree via the amalgamated file. | ||||
You could add the amalgamated file directly to your project, but doing it | You could add the amalgamated file directly to your project, but doing it | ||||
like this allows you to put your app's config settings in the | |||||
juce_AppConfig.h file and have them applied to both the juce headers and | |||||
like this allows you to put your app's config settings in the | |||||
juce_AppConfig.h file and have them applied to both the juce headers and | |||||
the source code. | the source code. | ||||
*/ | */ | ||||
@@ -1,10 +1,10 @@ | |||||
/* | |||||
/* | |||||
This file includes the entire juce source tree via the amalgamated file. | This file includes the entire juce source tree via the amalgamated file. | ||||
You could add the amalgamated file directly to your project, but doing it | You could add the amalgamated file directly to your project, but doing it | ||||
like this allows you to put your app's config settings in the | |||||
juce_AppConfig.h file and have them applied to both the juce headers and | |||||
like this allows you to put your app's config settings in the | |||||
juce_AppConfig.h file and have them applied to both the juce headers and | |||||
the source code. | the source code. | ||||
*/ | */ | ||||
@@ -11,7 +11,7 @@ | |||||
#include "MainComponent.h" | #include "MainComponent.h" | ||||
//============================================================================== | //============================================================================== | ||||
/** | |||||
/** | |||||
This is the top-level window that we'll pop up. Inside it, we'll create and | This is the top-level window that we'll pop up. Inside it, we'll create and | ||||
show a component from the MainComponent.cpp file (you can open this file using | show a component from the MainComponent.cpp file (you can open this file using | ||||
the Jucer to edit it). | the Jucer to edit it). | ||||
@@ -20,13 +20,13 @@ class HelloWorldWindow : public DocumentWindow | |||||
{ | { | ||||
public: | public: | ||||
//============================================================================== | //============================================================================== | ||||
HelloWorldWindow() | |||||
HelloWorldWindow() | |||||
: DocumentWindow (T("JUCE Hello World!"), | : DocumentWindow (T("JUCE Hello World!"), | ||||
Colours::lightgrey, | |||||
Colours::lightgrey, | |||||
DocumentWindow::allButtons, | DocumentWindow::allButtons, | ||||
true) | true) | ||||
{ | { | ||||
// Create an instance of our main content component, and add it | |||||
// Create an instance of our main content component, and add it | |||||
// to our window. | // to our window. | ||||
MainComponent* const contentComponent = new MainComponent(); | MainComponent* const contentComponent = new MainComponent(); | ||||
@@ -46,9 +46,9 @@ public: | |||||
//============================================================================== | //============================================================================== | ||||
void closeButtonPressed() | void closeButtonPressed() | ||||
{ | { | ||||
// When the user presses the close button, we'll tell the app to quit. This | |||||
// When the user presses the close button, we'll tell the app to quit. This | |||||
// window will be deleted by our HelloWorldApplication::shutdown() method | // window will be deleted by our HelloWorldApplication::shutdown() method | ||||
// | |||||
// | |||||
JUCEApplication::quit(); | JUCEApplication::quit(); | ||||
} | } | ||||
}; | }; | ||||
@@ -1,5 +1,5 @@ | |||||
/* | /* | ||||
This file contains settings that you might want to explicitly apply to | |||||
This file contains settings that you might want to explicitly apply to | |||||
your Juce build. | your Juce build. | ||||
These flags enable or disable juce features - if you're linking to juce as | These flags enable or disable juce features - if you're linking to juce as | ||||
@@ -8,7 +8,7 @@ | |||||
just include this file before including your juce_amalgamated.cpp file to | just include this file before including your juce_amalgamated.cpp file to | ||||
have the same effect. | have the same effect. | ||||
If you leave any of these commented-out, they'll take on the default value | |||||
If you leave any of these commented-out, they'll take on the default value | |||||
assigned to them in juce_Config.h, so to force them on or off, just set them | assigned to them in juce_Config.h, so to force them on or off, just set them | ||||
to an explicit 0 or 1 in here. | to an explicit 0 or 1 in here. | ||||
*/ | */ | ||||
@@ -1,10 +1,10 @@ | |||||
/* | |||||
/* | |||||
This file includes the entire juce source tree via the amalgamated file. | This file includes the entire juce source tree via the amalgamated file. | ||||
You could add the amalgamated file directly to your project, but doing it | You could add the amalgamated file directly to your project, but doing it | ||||
like this allows you to put your app's config settings in the | |||||
juce_AppConfig.h file and have them applied to both the juce headers and | |||||
like this allows you to put your app's config settings in the | |||||
juce_AppConfig.h file and have them applied to both the juce headers and | |||||
the source code. | the source code. | ||||
*/ | */ | ||||
@@ -1,12 +1,12 @@ | |||||
/* | |||||
This file includes the entire juce source tree via the amalgamated file. | |||||
You could add the amalgamated file directly to your project, but doing it | |||||
like this allows you to put your app's config settings in the | |||||
juce_AppConfig.h file and have them applied to both the juce headers and | |||||
the source code. | |||||
*/ | |||||
#include "juce_AppConfig.h" | |||||
#include "../../../juce_amalgamated.mm" | |||||
/* | |||||
This file includes the entire juce source tree via the amalgamated file. | |||||
You could add the amalgamated file directly to your project, but doing it | |||||
like this allows you to put your app's config settings in the | |||||
juce_AppConfig.h file and have them applied to both the juce headers and | |||||
the source code. | |||||
*/ | |||||
#include "juce_AppConfig.h" | |||||
#include "../../../juce_amalgamated.mm" |
@@ -98,8 +98,8 @@ END_JUCE_NAMESPACE | |||||
/* "Rectangle" is defined in some of the newer windows header files, so this makes | /* "Rectangle" is defined in some of the newer windows header files, so this makes | ||||
it easier to use the juce version explicitly. | it easier to use the juce version explicitly. | ||||
If you run into difficulties where this macro interferes with other 3rd party header | |||||
files, you may need to use the juce_WithoutMacros.h file - see the comments in that | |||||
If you run into difficulties where this macro interferes with other 3rd party header | |||||
files, you may need to use the juce_WithoutMacros.h file - see the comments in that | |||||
file for more information. | file for more information. | ||||
*/ | */ | ||||
#if JUCE_WINDOWS && ! JUCE_DONT_DEFINE_MACROS | #if JUCE_WINDOWS && ! JUCE_DONT_DEFINE_MACROS | ||||
@@ -258063,7 +258063,7 @@ bool File::moveToTrash() const throw() | |||||
struct FindFileStruct | struct FindFileStruct | ||||
{ | { | ||||
NSDirectoryEnumerator* enumerator; | NSDirectoryEnumerator* enumerator; | ||||
String parentDir; | |||||
String parentDir, wildCard; | |||||
}; | }; | ||||
bool juce_findFileNext (void* handle, String& resultFile, | bool juce_findFileNext (void* handle, String& resultFile, | ||||
@@ -258071,46 +258071,53 @@ bool juce_findFileNext (void* handle, String& resultFile, | |||||
{ | { | ||||
FindFileStruct* ff = (FindFileStruct*) handle; | FindFileStruct* ff = (FindFileStruct*) handle; | ||||
NSString* file; | NSString* file; | ||||
const char* const wildcardUTF8 = ff->wildCard.toUTF8(); | |||||
if (ff == 0 || (file = [ff->enumerator nextObject]) == 0) | |||||
return false; | |||||
for (;;) | |||||
{ | |||||
if (ff == 0 || (file = [ff->enumerator nextObject]) == 0) | |||||
return false; | |||||
[ff->enumerator skipDescendents]; | |||||
resultFile = nsStringToJuce (file); | |||||
[ff->enumerator skipDescendents]; | |||||
resultFile = nsStringToJuce (file); | |||||
const String path (ff->parentDir + resultFile); | |||||
if (fnmatch (wildcardUTF8, resultFile.toUTF8(), FNM_CASEFOLD) != 0) | |||||
continue; | |||||
if (isDir != 0 || fileSize != 0) | |||||
{ | |||||
struct stat info; | |||||
const bool statOk = juce_stat (path, info); | |||||
const String path (ff->parentDir + resultFile); | |||||
if (isDir != 0) | |||||
*isDir = statOk && ((info.st_mode & S_IFDIR) != 0); | |||||
if (isDir != 0 || fileSize != 0) | |||||
{ | |||||
struct stat info; | |||||
const bool statOk = juce_stat (path, info); | |||||
if (isHidden != 0) | |||||
*isHidden = juce_isHiddenFile (path); | |||||
if (isDir != 0) | |||||
*isDir = statOk && ((info.st_mode & S_IFDIR) != 0); | |||||
if (fileSize != 0) | |||||
*fileSize = statOk ? info.st_size : 0; | |||||
} | |||||
if (isHidden != 0) | |||||
*isHidden = juce_isHiddenFile (path); | |||||
if (modTime != 0 || creationTime != 0) | |||||
{ | |||||
int64 m, a, c; | |||||
juce_getFileTimes (path, m, a, c); | |||||
if (fileSize != 0) | |||||
*fileSize = statOk ? info.st_size : 0; | |||||
} | |||||
if (modTime != 0) | |||||
*modTime = m; | |||||
if (modTime != 0 || creationTime != 0) | |||||
{ | |||||
int64 m, a, c; | |||||
juce_getFileTimes (path, m, a, c); | |||||
if (creationTime != 0) | |||||
*creationTime = c; | |||||
} | |||||
if (modTime != 0) | |||||
*modTime = m; | |||||
if (isReadOnly != 0) | |||||
*isReadOnly = ! juce_canWriteToFile (path); | |||||
if (creationTime != 0) | |||||
*creationTime = c; | |||||
} | |||||
return true; | |||||
if (isReadOnly != 0) | |||||
*isReadOnly = ! juce_canWriteToFile (path); | |||||
return true; | |||||
} | |||||
} | } | ||||
void* juce_findFileStart (const String& directory, const String& wildCard, String& firstResultFile, | void* juce_findFileStart (const String& directory, const String& wildCard, String& firstResultFile, | ||||
@@ -258124,6 +258131,7 @@ void* juce_findFileStart (const String& directory, const String& wildCard, Strin | |||||
FindFileStruct* ff = new FindFileStruct(); | FindFileStruct* ff = new FindFileStruct(); | ||||
ff->enumerator = [e retain]; | ff->enumerator = [e retain]; | ||||
ff->parentDir = directory; | ff->parentDir = directory; | ||||
ff->wildCard = wildCard; | |||||
if (! ff->parentDir.endsWithChar (File::separator)) | if (! ff->parentDir.endsWithChar (File::separator)) | ||||
ff->parentDir += File::separator; | ff->parentDir += File::separator; | ||||
@@ -258370,7 +258378,7 @@ void Desktop::setMousePosition (int x, int y) throw() | |||||
void Desktop::setScreenSaverEnabled (const bool isEnabled) throw() | void Desktop::setScreenSaverEnabled (const bool isEnabled) throw() | ||||
{ | { | ||||
[[UIApplication sharedApplication] setIdleTimerDisabled: ! isEnabled]; | |||||
[[UIApplication sharedApplication] setIdleTimerDisabled: ! isEnabled]; | |||||
} | } | ||||
bool Desktop::isScreenSaverEnabled() throw() | bool Desktop::isScreenSaverEnabled() throw() | ||||
@@ -1,10 +1,10 @@ | |||||
/* | |||||
When using XCode, you should add this file to your project | |||||
instead of using juce_amalgamated.cpp directly. | |||||
This is because on the Mac we need to force the compiler to | |||||
treat the code as mixed C++/objective-C. | |||||
*/ | |||||
#include "juce_amalgamated.cpp" | |||||
/* | |||||
When using XCode, you should add this file to your project | |||||
instead of using juce_amalgamated.cpp directly. | |||||
This is because on the Mac we need to force the compiler to | |||||
treat the code as mixed C++/objective-C. | |||||
*/ | |||||
#include "juce_amalgamated.cpp" |
@@ -26,4 +26,3 @@ | |||||
// This file just wraps juce_VSTPluginFormat.cpp in an objective-C wrapper | // This file just wraps juce_VSTPluginFormat.cpp in an objective-C wrapper | ||||
#define JUCE_MAC_VST_INCLUDED 1 | #define JUCE_MAC_VST_INCLUDED 1 | ||||
#include "juce_VSTPluginFormat.cpp" | #include "juce_VSTPluginFormat.cpp" | ||||
@@ -145,7 +145,7 @@ void Desktop::setMousePosition (int x, int y) throw() | |||||
//============================================================================== | //============================================================================== | ||||
void Desktop::setScreenSaverEnabled (const bool isEnabled) throw() | void Desktop::setScreenSaverEnabled (const bool isEnabled) throw() | ||||
{ | { | ||||
[[UIApplication sharedApplication] setIdleTimerDisabled: ! isEnabled]; | |||||
[[UIApplication sharedApplication] setIdleTimerDisabled: ! isEnabled]; | |||||
} | } | ||||
bool Desktop::isScreenSaverEnabled() throw() | bool Desktop::isScreenSaverEnabled() throw() | ||||
@@ -334,7 +334,7 @@ bool File::moveToTrash() const throw() | |||||
struct FindFileStruct | struct FindFileStruct | ||||
{ | { | ||||
NSDirectoryEnumerator* enumerator; | NSDirectoryEnumerator* enumerator; | ||||
String parentDir; | |||||
String parentDir, wildCard; | |||||
}; | }; | ||||
bool juce_findFileNext (void* handle, String& resultFile, | bool juce_findFileNext (void* handle, String& resultFile, | ||||
@@ -342,46 +342,53 @@ bool juce_findFileNext (void* handle, String& resultFile, | |||||
{ | { | ||||
FindFileStruct* ff = (FindFileStruct*) handle; | FindFileStruct* ff = (FindFileStruct*) handle; | ||||
NSString* file; | NSString* file; | ||||
const char* const wildcardUTF8 = ff->wildCard.toUTF8(); | |||||
if (ff == 0 || (file = [ff->enumerator nextObject]) == 0) | |||||
return false; | |||||
for (;;) | |||||
{ | |||||
if (ff == 0 || (file = [ff->enumerator nextObject]) == 0) | |||||
return false; | |||||
[ff->enumerator skipDescendents]; | |||||
resultFile = nsStringToJuce (file); | |||||
[ff->enumerator skipDescendents]; | |||||
resultFile = nsStringToJuce (file); | |||||
const String path (ff->parentDir + resultFile); | |||||
if (fnmatch (wildcardUTF8, resultFile.toUTF8(), FNM_CASEFOLD) != 0) | |||||
continue; | |||||
if (isDir != 0 || fileSize != 0) | |||||
{ | |||||
struct stat info; | |||||
const bool statOk = juce_stat (path, info); | |||||
const String path (ff->parentDir + resultFile); | |||||
if (isDir != 0) | |||||
*isDir = statOk && ((info.st_mode & S_IFDIR) != 0); | |||||
if (isDir != 0 || fileSize != 0) | |||||
{ | |||||
struct stat info; | |||||
const bool statOk = juce_stat (path, info); | |||||
if (isHidden != 0) | |||||
*isHidden = juce_isHiddenFile (path); | |||||
if (isDir != 0) | |||||
*isDir = statOk && ((info.st_mode & S_IFDIR) != 0); | |||||
if (fileSize != 0) | |||||
*fileSize = statOk ? info.st_size : 0; | |||||
} | |||||
if (isHidden != 0) | |||||
*isHidden = juce_isHiddenFile (path); | |||||
if (modTime != 0 || creationTime != 0) | |||||
{ | |||||
int64 m, a, c; | |||||
juce_getFileTimes (path, m, a, c); | |||||
if (fileSize != 0) | |||||
*fileSize = statOk ? info.st_size : 0; | |||||
} | |||||
if (modTime != 0) | |||||
*modTime = m; | |||||
if (modTime != 0 || creationTime != 0) | |||||
{ | |||||
int64 m, a, c; | |||||
juce_getFileTimes (path, m, a, c); | |||||
if (creationTime != 0) | |||||
*creationTime = c; | |||||
} | |||||
if (modTime != 0) | |||||
*modTime = m; | |||||
if (isReadOnly != 0) | |||||
*isReadOnly = ! juce_canWriteToFile (path); | |||||
if (creationTime != 0) | |||||
*creationTime = c; | |||||
} | |||||
return true; | |||||
if (isReadOnly != 0) | |||||
*isReadOnly = ! juce_canWriteToFile (path); | |||||
return true; | |||||
} | |||||
} | } | ||||
void* juce_findFileStart (const String& directory, const String& wildCard, String& firstResultFile, | void* juce_findFileStart (const String& directory, const String& wildCard, String& firstResultFile, | ||||
@@ -395,6 +402,7 @@ void* juce_findFileStart (const String& directory, const String& wildCard, Strin | |||||
FindFileStruct* ff = new FindFileStruct(); | FindFileStruct* ff = new FindFileStruct(); | ||||
ff->enumerator = [e retain]; | ff->enumerator = [e retain]; | ||||
ff->parentDir = directory; | ff->parentDir = directory; | ||||
ff->wildCard = wildCard; | |||||
if (! ff->parentDir.endsWithChar (File::separator)) | if (! ff->parentDir.endsWithChar (File::separator)) | ||||
ff->parentDir += File::separator; | ff->parentDir += File::separator; | ||||