Get DAW host version

Hello Juce dev !

I’m currently looking for a way to get the DAW host version like Logic Pro 10.7.8

I know that PluginHostType exists, but it only returns the name of the host.

I would like to be able to get the version for analytics purpose.

Is there a way to get it ?

Thanks

Some of the hosts have some version info in their name (such as “Live 11” or “Cubase 10.5.app”), but in general, no. All that is retrieved is the host name (and path to it). Now, you could, I suppose, use the path info to get the Properties/Get Info data via native OS functions. But I don’t see anything in Juce itself that gives you that information.

There is actually, @HowardAntares gave me the idea to look for File::getVersion()
Worth a try:

auto version = juce::File::getSpecialLocation (juce::File::hostApplicationPath)
              .getVersion();

a bit confusing that it says path, but I assume because on mac it is the bundle i.e. a directory and on windows the exe.

3 Likes

sweet!

Thank you @HowardAntares and @daniel
Daniel it’s seems to be really clever !
I cannot try it right now since I discovered that I cannot build an AU or VST with Xcode 15 and its cycle error but I will try it asap.

Hello @daniel just to give you some feedback about your method.
It worked… partially.
Indeed, on MacOS when I do

const auto filePath = juce::File::getSpecialLocation(juce::File::hostApplicationPath)
const auto version = filePath.getVersion();

I get /Aplication/<HostApplication>.app/Contents/MacOS for filePath
However version is empty. And this is normal because the implementation of getVersion() expect to have a path that looks like this: /Aplication/<HostApplication>.app

I could maybe retrieve the path by myself but it would be error-prone since it will change for other OS.

Also, I saw that JUCE did this trick for the File::getSpecialLocation method

Would it be possible to get a path with the /Aplication/<HostApplication>.app format directly from JUCE in order to handle all the edge cases (macOS, Windows and other) and prevent to do a lot of #if #else palteform ?

Maybe @reuk or @dave96 could help on this ? Since I don’t know if it’s a bug or an expected behaviour :thinking:

Thanks

I’m working again on this issue.
@reuk or @dave96 would you have any insight on it?
Having the version of the DAW would be great.

Currently

juce::File::getSpecialLocation(juce::File::hostApplicationPath);

gives /Applications/Ableton Live 12 Suite.app/Contents/MacOS/Live.

So I need to do

const auto file = juce::File::getSpecialLocation(juce::File::hostApplicationPath).getParentDirectory().getParentDirectory().getParentDirectory();
const auto version = file.getVersion();

in order to get the version.

However I’m worried about few things:

  1. Would it be the same for all DAW on macOS ?
  2. What about on Windows ?

What do you think about creating a method to get directly the DAW version ?

Thanks

I think that’s generally the same path for most apps but I’m not sure if it’s enforced.

Thanks @dave96 for the insight. So I guess it’s a little bit minefield and I could have some surprises :confused: