Author Topic: Workspace Properties  (Read 2280 times)

skywise

  • Senior Community Member
  • Posts: 331
  • Hero Points: 10
Workspace Properties
« on: January 10, 2014, 10:18:32 pm »
I see under the Project Properties open tab that I can run certain commands when that project is opened.  My current build environment requires running a script that sets up the environment (variables plus running other scripts as setup by our dev management team which change at whim) to the current build configuration.

Our product is built out of multiple smaller programs and shared libs so my workspace is setup with individual projects for each of them.  I then have multiple workspaces for each branch/build target version of the product.

Currently what I do is start a command shell, run the setup script and then start VS and everything builds fine - Except for the occasional flub when I switch workspaces to a different target and spend an hour trying to figure out why nothing builds anymore!   ;D

This open tab sounds like a pretty close approximation to what I need except I don't need to run it whenever I switch projects but only when I switch Workspaces - But the only thing I can change when opening a workspace is specific environment variables.  Is there a way to run a script when opening a workspace?

ronw

  • Community Member
  • Posts: 36
  • Hero Points: 0
Re: Workspace Properties
« Reply #1 on: January 11, 2014, 01:00:02 am »
Odd there would not be a workspace "open" hook. It could be approximated by your script comparing the current workspace name to a value saved in a file. If the names match, then exit the script. Otherwise, it does your setup, then writes the workspace name to the file. Of course, this file would have to be outside of your workspaces, for example, in the parent of your workspaces.

Graeme

  • Senior Community Member
  • Posts: 2431
  • Hero Points: 322
Re: Workspace Properties
« Reply #2 on: January 11, 2014, 03:46:03 am »
Search slick c macro source files for call_list and you'll find there's a _workspace_opened hook.  So you can write a function whose name starts with_workspace_opened and it will get called when a workspace is opened.

void _workspace_opened_something_or_other()
{
   _message_box(_workspace_filename);
    switch (_workspace_filename)
   {
       case 'whatever' :
            _message_box("hello");
           break;
      case 'whereever' :
            _message_box("hello hello");
           break;
   }
}
« Last Edit: December 26, 2015, 09:09:39 am by Graeme »