How can I create different versions of the Projucer?


#1

Hi !
The answer to this question is probably somewhere in the forum, but it seems that I can’t find it.
I want to create different versions of the projucer (lets call them “projucer-5.4.1”, “projucer-5.3.2” and “projucer-develop”) so I can quickly test the same source code with various versions of the JUCE library.
I am using OSX 10.11.6 and Xcode 8.2.1. It seems that whatever I do to rename the files, the binaries or change strings in the plist of the applications, all versions are recognized as the same application, “Projucer”, and all use the same path “~/Library/Application Support/Projucer” to access the preferences file “Projucer.settings”. Therefore, the same preference are shared between all the instances, and I can’t have separate “global paths” to access specific modules. Is there a way to associate different preferences files to different versions of the projucer ?
Thanks for any help…


#2

No, they will all share the same global preferences file and so the global modules path will always point to the same place.

Assuming you’re using git to manage JUCE, you can just check out the version tag that you want to test and rebuild your project:

cd path/to/JUCE & git checkout 5.3.2


#3

Hi !

So I finally decided to build a small script to manage the various preference files. This solution will probably work on most Mac OSX, and may probably be adapted to Linux.
This is what I did.
The preferences are kept in th user folder:

Library/Application Support/Projucer

which contains these files:

Analytics  ProjectSettings  Projucer.settings  Schemes

You only care about “Projucer.settings” which contains the global paths to the JUCE modules.
So I created copies of “Projucer.settings”, with names such as “Projucer-5.3.2.settings”, “Projucer-5.4.1.settings” and “Projucer-develop.settings” corresponding to the three versions of JUCE I am currently working with.
Then I wrote this script:

#!/bin/bash
target="5.4.1"  # the code for the target
path="/Applications/JUCE_5.4.1/Projucer-5.4.1.app" # The location of the application
# ------------------ nothing to change under this -------------
cd "/Users/myaccount/Library/Application Support/Projucer"
if [ -f "lastsetting.txt" ] ; then
    last=$(<lastsetting.txt)
else
    last="xxx"
fi
#  We want the target configuration
if [ "${last}" == "${target}" ] ; then
    # The target is the last used configuration
    # Check that we have a "Projucer.settings" file
    if [ ! -f  "Projucer.settings" ] ; then
        cp "Projucer-${target}.settings" "Projucer.settings"
    fi
else
    # Our target was NOT the configuration last used
    # If necessary, save the "Projucer.settings" in the previous back-up
    if [ -f "Projucer.settings" ] ; then
        if [ -f "Projucer-"${last}".settings" ] ; then
            # Just in case, save a back-up of the back-up
            mv "Projucer-"${last}".settings" "Projucer-prev-"${last}".settings"
        fi
        mv "Projucer.settings" "Projucer-"${last}".settings"
    fi
    if [ -f "Projucer-${target}.settings" ] ; then
        if [ -f "Projucer.settings" ] ; then
            mv -f "Projucer.settings"  "Projucer-prev.settings"
        fi
        cp "Projucer-${target}.settings" "Projucer.settings"
    else
        cp "Projucer-Original.settings" "Projucer.settings"
    fi
fi
echo -n "${target}" > lastsetting.txt
open -a  ${path}

which lets me run the appropriate version of the projucer and preferences I am using. This script is for 5.4.1. Just change the first two lines to select a different version of the projucer and the preferences, and you have the others.

Finally, as I wanted double clickable applications, I packaged the scripts in Mac applications, using the approach which is described in https://github.com/thedzy/Run-script-as-an-Applicaiton to have three double clickable icons that let me run the various projucers, with their various preferences.

Hope this approach can help some other people…