@@ -273,9 +273,17 @@ int JUCEApplication::shutdownAppAndClearUp() | |||||
extern int juce_IPhoneMain (int argc, char* argv[], JUCEApplication* app); | extern int juce_IPhoneMain (int argc, char* argv[], JUCEApplication* app); | ||||
#endif | #endif | ||||
#if ! JUCE_WINDOWS | |||||
extern const char* juce_Argv0; | |||||
#endif | |||||
int JUCEApplication::main (int argc, char* argv[], | int JUCEApplication::main (int argc, char* argv[], | ||||
JUCEApplication* const newApp) | JUCEApplication* const newApp) | ||||
{ | { | ||||
#if ! JUCE_WINDOWS | |||||
juce_Argv0 = argv[0]; | |||||
#endif | |||||
#if JUCE_IPHONE | #if JUCE_IPHONE | ||||
const ScopedAutoReleasePool pool; | const ScopedAutoReleasePool pool; | ||||
return juce_IPhoneMain (argc, argv, newApp); | return juce_IPhoneMain (argc, argv, newApp); | ||||
@@ -779,6 +779,9 @@ public: | |||||
On the mac this will return the unix binary, not the package folder - see | On the mac this will return the unix binary, not the package folder - see | ||||
currentApplicationFile for that. | currentApplicationFile for that. | ||||
See also invokedExecutableFile, which is similar, but if the exe was launched from a | |||||
file link, invokedExecutableFile will return the name of the link. | |||||
*/ | */ | ||||
currentExecutableFile, | currentExecutableFile, | ||||
@@ -792,6 +795,13 @@ public: | |||||
*/ | */ | ||||
currentApplicationFile, | currentApplicationFile, | ||||
/** Returns the file that was invoked to launch this executable. | |||||
This may differ from currentExecutableFile if the app was started from e.g. a link - this | |||||
will return the name of the link that was used, whereas currentExecutableFile will return | |||||
the actual location of the target executable. | |||||
*/ | |||||
invokedExecutableFile, | |||||
/** The directory in which applications normally get installed. | /** The directory in which applications normally get installed. | ||||
So on windows, this would be something like "c:\program files", on the | So on windows, this would be something like "c:\program files", on the | ||||
@@ -171,6 +171,8 @@ bool File::isHidden() const throw() | |||||
} | } | ||||
//============================================================================== | //============================================================================== | ||||
const char* juce_Argv0 = 0; // referenced from juce_Application.cpp | |||||
const File File::getSpecialLocation (const SpecialLocationType type) | const File File::getSpecialLocation (const SpecialLocationType type) | ||||
{ | { | ||||
switch (type) | switch (type) | ||||
@@ -219,6 +221,11 @@ const File File::getSpecialLocation (const SpecialLocationType type) | |||||
return tmp; | return tmp; | ||||
} | } | ||||
case invokedExecutableFile: | |||||
if (juce_Argv0 != 0) | |||||
return File (String::fromUTF8 ((const uint8*) juce_Argv0)); | |||||
// deliberate fall-through... | |||||
case currentExecutableFile: | case currentExecutableFile: | ||||
case currentApplicationFile: | case currentApplicationFile: | ||||
return juce_getExecutableFile(); | return juce_getExecutableFile(); | ||||
@@ -182,6 +182,8 @@ bool File::isHidden() const throw() | |||||
} | } | ||||
//============================================================================== | //============================================================================== | ||||
const char* juce_Argv0 = 0; // referenced from juce_Application.cpp | |||||
const File File::getSpecialLocation (const SpecialLocationType type) | const File File::getSpecialLocation (const SpecialLocationType type) | ||||
{ | { | ||||
const ScopedAutoReleasePool pool; | const ScopedAutoReleasePool pool; | ||||
@@ -230,6 +232,11 @@ const File File::getSpecialLocation (const SpecialLocationType type) | |||||
return tmp.getFullPathName(); | return tmp.getFullPathName(); | ||||
} | } | ||||
case invokedExecutableFile: | |||||
if (juce_Argv0 != 0) | |||||
return File (String::fromUTF8 ((const uint8*) juce_Argv0)); | |||||
// deliberate fall-through... | |||||
case currentExecutableFile: | case currentExecutableFile: | ||||
return juce_getExecutableFile(); | return juce_getExecutableFile(); | ||||
@@ -489,6 +489,7 @@ const File JUCE_CALLTYPE File::getSpecialLocation (const SpecialLocationType typ | |||||
return File (String (dest)); | return File (String (dest)); | ||||
} | } | ||||
case invokedExecutableFile: | |||||
case currentExecutableFile: | case currentExecutableFile: | ||||
case currentApplicationFile: | case currentApplicationFile: | ||||
{ | { | ||||