Browse Source

fix for a mac file bug introduced in the last check-in..

tags/2021-05-28
Julian Storer 15 years ago
parent
commit
0280c57ff0
19 changed files with 145 additions and 131 deletions
  1. +9
    -10
      extras/amalgamator/juce_AmalgamatorMain.cpp
  2. +2
    -2
      extras/amalgamator/juce_AppConfig.h
  3. +3
    -3
      extras/amalgamator/juce_LibrarySource.cpp
  4. +3
    -3
      extras/amalgamator/juce_LibrarySource.mm
  5. +1
    -1
      extras/audio plugins/demo/src/DemoJuceFilter.h
  6. +8
    -8
      extras/binarybuilder/BinaryBuilder.cpp
  7. +2
    -2
      extras/binarybuilder/juce_AppConfig.h
  8. +3
    -3
      extras/binarybuilder/juce_LibrarySource.cpp
  9. +3
    -3
      extras/binarybuilder/juce_LibrarySource.mm
  10. +6
    -6
      extras/example projects/common/Main.cpp
  11. +2
    -2
      extras/example projects/common/juce_AppConfig.h
  12. +3
    -3
      extras/example projects/common/juce_LibrarySource.cpp
  13. +12
    -12
      extras/example projects/common/juce_LibrarySource.mm
  14. +2
    -2
      juce.h
  15. +38
    -30
      juce_amalgamated.cpp
  16. +10
    -10
      juce_amalgamated.mm
  17. +0
    -1
      src/audio/plugins/formats/juce_VSTPluginFormat.mm
  18. +1
    -1
      src/native/mac/juce_iphone_MiscUtilities.mm
  19. +37
    -29
      src/native/mac/juce_mac_Files.mm

+ 9
- 10
extras/amalgamator/juce_AmalgamatorMain.cpp View File

@@ -71,8 +71,8 @@ static bool canFileBeReincluded (const File& f)
//==============================================================================
static bool parseFile (const File& rootFolder,
const File& newTargetFile,
StringArray& dest,
const File& file,
StringArray& dest,
const File& file,
StringArray& alreadyIncludedFiles,
const StringArray& includesToIgnore,
const StringArray& wildcards,
@@ -133,18 +133,18 @@ static bool parseFile (const File& rootFolder,
alreadyIncludedFiles.add (targetFile.getFullPathName());
dest.add (String::empty);
dest.add (T("/********* Start of inlined file: ")
dest.add (T("/********* Start of inlined file: ")
+ targetFile.getFileName()
+ T(" *********/"));
if (! parseFile (rootFolder, newTargetFile,
if (! parseFile (rootFolder, newTargetFile,
dest, targetFile, alreadyIncludedFiles, includesToIgnore,
wildcards, false, stripUnnecessaryStuff))
{
return false;
}
dest.add (T("/********* End of inlined file: ")
dest.add (T("/********* End of inlined file: ")
+ targetFile.getFileName()
+ T(" *********/"));
dest.add (String::empty);
@@ -192,9 +192,9 @@ static bool munge (const File& templateFile, const File& targetFile, const Strin
wildcards.trim();
wildcards.removeEmptyStrings();
if (! parseFile (targetFile.getParentDirectory(),
if (! parseFile (targetFile.getParentDirectory(),
targetFile,
lines, templateFile,
lines, templateFile,
alreadyIncludedFiles,
includesToIgnore,
wildcards,
@@ -296,7 +296,7 @@ static void mungeJuce (const File& juceFolder)
//==============================================================================
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..
initialiseJuce_NonGUI();
@@ -327,10 +327,9 @@ int main (int argc, char* argv[])
" ignoring any repeated instances of it.\n\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"
" Or: just run 'amalgamator YourJuceDirectory' to rebuild the juce files."
" Or: just run 'amalgamator YourJuceDirectory' to rebuild the juce files."
);
}
return 0;
}

+ 2
- 2
extras/amalgamator/juce_AppConfig.h View File

@@ -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.
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
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
to an explicit 0 or 1 in here.
*/


+ 3
- 3
extras/amalgamator/juce_LibrarySource.cpp View File

@@ -1,10 +1,10 @@
/*
/*
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
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.
*/


+ 3
- 3
extras/amalgamator/juce_LibrarySource.mm View File

@@ -1,10 +1,10 @@
/*
/*
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
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.
*/


+ 1
- 1
extras/audio plugins/demo/src/DemoJuceFilter.h View File

@@ -45,7 +45,7 @@ public:
void prepareToPlay (double sampleRate, int samplesPerBlock);
void releaseResources();
void processBlock (AudioSampleBuffer& buffer,
void processBlock (AudioSampleBuffer& buffer,
MidiBuffer& midiMessages);
//==============================================================================


+ 8
- 8
extras/binarybuilder/BinaryBuilder.cpp View File

@@ -17,7 +17,7 @@
//==============================================================================
static int addFile (const File& file,
const String& classname,
const String& classname,
OutputStream& headerStream,
OutputStream& cppStream)
{
@@ -29,7 +29,7 @@ static int addFile (const File& file,
.replaceCharacter ('.', '_')
.retainCharacters (T("abcdefghijklmnopqrstuvwxyz_0123456789")));
printf ("Adding %s: %d bytes\n",
printf ("Adding %s: %d bytes\n",
(const char*) name,
mb.getSize());
@@ -59,8 +59,8 @@ static int addFile (const File& file,
cppStream.printf ("%d,0,0};\r\n", (int) data[i]);
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);
return mb.getSize();
@@ -78,7 +78,7 @@ static bool isHiddenFile (const File& f, const File& root)
//==============================================================================
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..
initialiseJuce_NonGUI();
@@ -128,15 +128,15 @@ int main (int argc, char* argv[])
const File cppFile (destDirectory.getChildFile (className).withFileExtension (T(".cpp")));
String message;
message << "Creating " << headerFile.getFullPathName()
message << "Creating " << headerFile.getFullPathName()
<< " and " << cppFile.getFullPathName()
<< " from files in " << sourceDirectory.getFullPathName()
<< " from files in " << sourceDirectory.getFullPathName()
<< "...\n\n";
printf ((const char*) message);
OwnedArray <File> files;
sourceDirectory.findChildFiles (files, File::findFiles, true,
sourceDirectory.findChildFiles (files, File::findFiles, true,
(argc > 4) ? argv[4] : "*");
if (files.size() == 0)


+ 2
- 2
extras/binarybuilder/juce_AppConfig.h View File

@@ -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.
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
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
to an explicit 0 or 1 in here.
*/


+ 3
- 3
extras/binarybuilder/juce_LibrarySource.cpp View File

@@ -1,10 +1,10 @@
/*
/*
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
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.
*/


+ 3
- 3
extras/binarybuilder/juce_LibrarySource.mm View File

@@ -1,10 +1,10 @@
/*
/*
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
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.
*/


+ 6
- 6
extras/example projects/common/Main.cpp View File

@@ -11,7 +11,7 @@
#include "MainComponent.h"
//==============================================================================
/**
/**
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
the Jucer to edit it).
@@ -20,13 +20,13 @@ class HelloWorldWindow : public DocumentWindow
{
public:
//==============================================================================
HelloWorldWindow()
HelloWorldWindow()
: DocumentWindow (T("JUCE Hello World!"),
Colours::lightgrey,
Colours::lightgrey,
DocumentWindow::allButtons,
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.
MainComponent* const contentComponent = new MainComponent();
@@ -46,9 +46,9 @@ public:
//==============================================================================
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
//
//
JUCEApplication::quit();
}
};


+ 2
- 2
extras/example projects/common/juce_AppConfig.h View File

@@ -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.
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
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
to an explicit 0 or 1 in here.
*/


+ 3
- 3
extras/example projects/common/juce_LibrarySource.cpp View File

@@ -1,10 +1,10 @@
/*
/*
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
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.
*/


+ 12
- 12
extras/example projects/common/juce_LibrarySource.mm View File

@@ -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"

+ 2
- 2
juce.h View File

@@ -98,8 +98,8 @@ END_JUCE_NAMESPACE
/* "Rectangle" is defined in some of the newer windows header files, so this makes
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.
*/
#if JUCE_WINDOWS && ! JUCE_DONT_DEFINE_MACROS


+ 38
- 30
juce_amalgamated.cpp View File

@@ -258063,7 +258063,7 @@ bool File::moveToTrash() const throw()
struct FindFileStruct
{
NSDirectoryEnumerator* enumerator;
String parentDir;
String parentDir, wildCard;
};

bool juce_findFileNext (void* handle, String& resultFile,
@@ -258071,46 +258071,53 @@ bool juce_findFileNext (void* handle, String& resultFile,
{
FindFileStruct* ff = (FindFileStruct*) handle;
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,
@@ -258124,6 +258131,7 @@ void* juce_findFileStart (const String& directory, const String& wildCard, Strin
FindFileStruct* ff = new FindFileStruct();
ff->enumerator = [e retain];
ff->parentDir = directory;
ff->wildCard = wildCard;

if (! ff->parentDir.endsWithChar (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()
{
[[UIApplication sharedApplication] setIdleTimerDisabled: ! isEnabled];
[[UIApplication sharedApplication] setIdleTimerDisabled: ! isEnabled];
}

bool Desktop::isScreenSaverEnabled() throw()


+ 10
- 10
juce_amalgamated.mm View File

@@ -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"

+ 0
- 1
src/audio/plugins/formats/juce_VSTPluginFormat.mm View File

@@ -26,4 +26,3 @@
// This file just wraps juce_VSTPluginFormat.cpp in an objective-C wrapper
#define JUCE_MAC_VST_INCLUDED 1
#include "juce_VSTPluginFormat.cpp"

+ 1
- 1
src/native/mac/juce_iphone_MiscUtilities.mm View File

@@ -145,7 +145,7 @@ void Desktop::setMousePosition (int x, int y) throw()
//==============================================================================
void Desktop::setScreenSaverEnabled (const bool isEnabled) throw()
{
[[UIApplication sharedApplication] setIdleTimerDisabled: ! isEnabled];
[[UIApplication sharedApplication] setIdleTimerDisabled: ! isEnabled];
}
bool Desktop::isScreenSaverEnabled() throw()


+ 37
- 29
src/native/mac/juce_mac_Files.mm View File

@@ -334,7 +334,7 @@ bool File::moveToTrash() const throw()
struct FindFileStruct
{
NSDirectoryEnumerator* enumerator;
String parentDir;
String parentDir, wildCard;
};
bool juce_findFileNext (void* handle, String& resultFile,
@@ -342,46 +342,53 @@ bool juce_findFileNext (void* handle, String& resultFile,
{
FindFileStruct* ff = (FindFileStruct*) handle;
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,
@@ -395,6 +402,7 @@ void* juce_findFileStart (const String& directory, const String& wildCard, Strin
FindFileStruct* ff = new FindFileStruct();
ff->enumerator = [e retain];
ff->parentDir = directory;
ff->wildCard = wildCard;
if (! ff->parentDir.endsWithChar (File::separator))
ff->parentDir += File::separator;


Loading…
Cancel
Save