| @@ -294,6 +294,12 @@ bool File::setAsCurrentWorkingDirectory() const throw() | |||||
| return chdir (getFullPathName().toUTF8()) == 0; | return chdir (getFullPathName().toUTF8()) == 0; | ||||
| } | } | ||||
| //============================================================================== | |||||
| const String File::getVersion() const throw() | |||||
| { | |||||
| return String::empty; // xxx not yet implemented | |||||
| } | |||||
| //============================================================================== | //============================================================================== | ||||
| const File File::getLinkedTarget() const throw() | const File File::getLinkedTarget() const throw() | ||||
| { | { | ||||
| @@ -330,6 +330,30 @@ bool File::setAsCurrentWorkingDirectory() const throw() | |||||
| return chdir (getFullPathName().toUTF8()) == 0; | return chdir (getFullPathName().toUTF8()) == 0; | ||||
| } | } | ||||
| //============================================================================== | |||||
| const String File::getVersion() const throw() | |||||
| { | |||||
| const ScopedAutoReleasePool pool; | |||||
| String result; | |||||
| NSBundle* bundle = [NSBundle bundleWithPath: juceStringToNS (getFullPathName())]; | |||||
| if (bundle != 0) | |||||
| { | |||||
| NSDictionary* info = [bundle infoDictionary]; | |||||
| if (info != 0) | |||||
| { | |||||
| NSString* name = [info valueForKey: @"CFBundleShortVersionString"]; | |||||
| if (name != nil) | |||||
| result = nsStringToJuce (name); | |||||
| } | |||||
| } | |||||
| return result; | |||||
| } | |||||
| //============================================================================== | //============================================================================== | ||||
| const File File::getLinkedTarget() const throw() | const File File::getLinkedTarget() const throw() | ||||
| { | { | ||||
| @@ -524,6 +524,35 @@ bool File::setAsCurrentWorkingDirectory() const throw() | |||||
| return SetCurrentDirectory (getFullPathName()) != FALSE; | return SetCurrentDirectory (getFullPathName()) != FALSE; | ||||
| } | } | ||||
| //============================================================================== | |||||
| const String File::getVersion() const throw() | |||||
| { | |||||
| String result; | |||||
| DWORD handle = 0; | |||||
| DWORD bufferSize = GetFileVersionInfoSize (getFullPathName(), &handle); | |||||
| void* buffer = juce_calloc (bufferSize); | |||||
| if (GetFileVersionInfo (getFullPathName(), 0, bufferSize, buffer)) | |||||
| { | |||||
| VS_FIXEDFILEINFO* vffi; | |||||
| UINT len = 0; | |||||
| if (VerQueryValue (buffer, _T("\\"), (LPVOID*) &vffi, &len)) | |||||
| { | |||||
| result.printf (T("%d.%d.%d.%d"), | |||||
| HIWORD (vffi->dwFileVersionMS), | |||||
| LOWORD (vffi->dwFileVersionMS), | |||||
| HIWORD (vffi->dwFileVersionLS), | |||||
| LOWORD (vffi->dwFileVersionLS)); | |||||
| } | |||||
| } | |||||
| juce_free (buffer); | |||||
| return result; | |||||
| } | |||||
| //============================================================================== | //============================================================================== | ||||
| const File File::getLinkedTarget() const throw() | const File File::getLinkedTarget() const throw() | ||||
| { | { | ||||
| @@ -240405,6 +240405,33 @@ bool File::setAsCurrentWorkingDirectory() const throw() | |||||
| return SetCurrentDirectory (getFullPathName()) != FALSE; | return SetCurrentDirectory (getFullPathName()) != FALSE; | ||||
| } | } | ||||
| const String File::getVersion() const throw() | |||||
| { | |||||
| String result; | |||||
| DWORD handle = 0; | |||||
| DWORD bufferSize = GetFileVersionInfoSize (getFullPathName(), &handle); | |||||
| void* buffer = juce_calloc (bufferSize); | |||||
| if (GetFileVersionInfo (getFullPathName(), 0, bufferSize, buffer)) | |||||
| { | |||||
| VS_FIXEDFILEINFO* vffi; | |||||
| UINT len = 0; | |||||
| if (VerQueryValue (buffer, _T("\\"), (LPVOID*) &vffi, &len)) | |||||
| { | |||||
| result.printf (T("%d.%d.%d.%d"), | |||||
| HIWORD (vffi->dwFileVersionMS), | |||||
| LOWORD (vffi->dwFileVersionMS), | |||||
| HIWORD (vffi->dwFileVersionLS), | |||||
| LOWORD (vffi->dwFileVersionLS)); | |||||
| } | |||||
| } | |||||
| juce_free (buffer); | |||||
| return result; | |||||
| } | |||||
| const File File::getLinkedTarget() const throw() | const File File::getLinkedTarget() const throw() | ||||
| { | { | ||||
| File result (*this); | File result (*this); | ||||
| @@ -254599,6 +254626,11 @@ bool File::setAsCurrentWorkingDirectory() const throw() | |||||
| return chdir (getFullPathName().toUTF8()) == 0; | return chdir (getFullPathName().toUTF8()) == 0; | ||||
| } | } | ||||
| const String File::getVersion() const throw() | |||||
| { | |||||
| return String::empty; // xxx not yet implemented | |||||
| } | |||||
| const File File::getLinkedTarget() const throw() | const File File::getLinkedTarget() const throw() | ||||
| { | { | ||||
| char buffer [4096]; | char buffer [4096]; | ||||
| @@ -264629,6 +264661,29 @@ bool File::setAsCurrentWorkingDirectory() const throw() | |||||
| return chdir (getFullPathName().toUTF8()) == 0; | return chdir (getFullPathName().toUTF8()) == 0; | ||||
| } | } | ||||
| const String File::getVersion() const throw() | |||||
| { | |||||
| const ScopedAutoReleasePool pool; | |||||
| String result; | |||||
| NSBundle* bundle = [NSBundle bundleWithPath: juceStringToNS (getFullPathName())]; | |||||
| if (bundle != 0) | |||||
| { | |||||
| NSDictionary* info = [bundle infoDictionary]; | |||||
| if (info != 0) | |||||
| { | |||||
| NSString* name = [info valueForKey: @"CFBundleShortVersionString"]; | |||||
| if (name != nil) | |||||
| result = nsStringToJuce (name); | |||||
| } | |||||
| } | |||||
| return result; | |||||
| } | |||||
| const File File::getLinkedTarget() const throw() | const File File::getLinkedTarget() const throw() | ||||
| { | { | ||||
| FSRef ref; | FSRef ref; | ||||
| @@ -6405,6 +6405,14 @@ public: | |||||
| */ | */ | ||||
| bool setCreationTime (const Time& newTime) const throw(); | bool setCreationTime (const Time& newTime) const throw(); | ||||
| /** If possible, this will try to create a version string for the given file. | |||||
| The OS may be able to look at the file and give a version for it - e.g. with | |||||
| executables, bundles, dlls, etc. If no version is available, this will | |||||
| return an empty string. | |||||
| */ | |||||
| const String getVersion() const throw(); | |||||
| /** Creates an empty file if it doesn't already exist. | /** Creates an empty file if it doesn't already exist. | ||||
| If the file that this object refers to doesn't exist, this will create a file | If the file that this object refers to doesn't exist, this will create a file | ||||
| @@ -404,6 +404,14 @@ public: | |||||
| */ | */ | ||||
| bool setCreationTime (const Time& newTime) const throw(); | bool setCreationTime (const Time& newTime) const throw(); | ||||
| /** If possible, this will try to create a version string for the given file. | |||||
| The OS may be able to look at the file and give a version for it - e.g. with | |||||
| executables, bundles, dlls, etc. If no version is available, this will | |||||
| return an empty string. | |||||
| */ | |||||
| const String getVersion() const throw(); | |||||
| //============================================================================== | //============================================================================== | ||||
| /** Creates an empty file if it doesn't already exist. | /** Creates an empty file if it doesn't already exist. | ||||