Author Topic: Question about hotfixes and how they are applied  (Read 3897 times)

timur

  • Senior Community Member
  • Posts: 186
  • Hero Points: 3
Question about hotfixes and how they are applied
« on: June 02, 2011, 03:25:17 pm »
There are a few customizations that I make to Slickedit by editing the macros in the macros/ directory.  For example, I keep all of my project files in one directory, so I want Slickedit to default to that directory when I do Project->Open Workspace.  I do it by making this change to function workspace_open():

      WorkspaceFilename=_OpenDialog(_stdform('_open_form')' -new -mdi -modal',
                                    'Open Workspace',
                                    '',     // Initial wildcards
                                    format_list,  // file types
                                    OFN_FILEMUSTEXIST,
                                    WORKSPACE_FILE_EXT,      // Default extensions
                                    '',      // Initial filename
--->                              '/home/b04825/projects/',      // Initial directory
                                    '',      // Reserved
                                    "Standard Open dialog box"
                                   );

So I recently applied the latest hotfix, and I see that instead of patching the files in the macros/ directory, it creates a new copy of wkspace.e in ~/.slickedit/16.0.0/hotfixes/.

So my question is: how can I apply hotfixes and make changes to the macro files?  Will I need to re-apply my changes to the ~/.slickedit/16.0.0/hotfixes/ directory every time I apply a new hotfix?

ScottW, VP of Dev

  • Senior Community Member
  • Posts: 1471
  • Hero Points: 64
Re: Question about hotfixes and how they are applied
« Reply #1 on: June 02, 2011, 06:19:58 pm »
Once the code in the macros directory has been compiled, it is not referenced again. Macro code is loaded from the state file. So, editing the macro files in the macros directory has no effect until you load the modified macro.

We caution users to not modify the files in the macros directory. Instead, copy the files to a new location and modify them there. Why? Because once you modify any of our files, we cannot effectively provide support. We need to know whether a problem is reproducible using the shipped code.

When you start SlickEdit with a new, clean config (using the -sc command line switch and pointing to a location that has never had a config in it), we build a new state file. This loads the original versions of the shipped macro files. Hot fixes applied in another config will not be present in this config. They will have to be loaded again.

The process of loading a hot fix replaces any definitions for functions and variables with the ones included in the newly loaded files. So, if you want to modify a function that was updated in a hot fix, you should save the file to a new location, modify it, and load it. Again, be sure to preserve the capability of testing SlickEdit with the unmodified version of the hot fix if you have any problems.

When a new hot fix is released, you can diff your version against the files in the new hot fix to merge your changes in. Again, we suggest that you save them to a separate directory so you know which are your modified versions and which are the ones we have shipped.

timur

  • Senior Community Member
  • Posts: 186
  • Hero Points: 3
Re: Question about hotfixes and how they are applied
« Reply #2 on: June 02, 2011, 06:30:13 pm »
That's what I was afraid of.  I guess I'll have to do things the hard way.   :(

What's the best way to make a feature request for a future release or hotfix of Slickedit 16?  I'd like the default directory for workspace_open() be a configurable option.

timur

  • Senior Community Member
  • Posts: 186
  • Hero Points: 3
Re: Question about hotfixes and how they are applied
« Reply #3 on: June 02, 2011, 07:21:21 pm »
The process of loading a hot fix replaces any definitions for functions and variables with the ones included in the newly loaded files. So, if you want to modify a function that was updated in a hot fix, you should save the file to a new location, modify it, and load it. Again, be sure to preserve the capability of testing SlickEdit with the unmodified version of the hot fix if you have any problems.

I can't get this part to work.

After applying the hotfix, I copy wkspace.e from ~/.slickedit/16.0.0/hotfixes/ to ~/.slickedit/16.0.0/macros/.  I edited the file, and made this change:

      WorkspaceFilename=_OpenDialog(_stdform('_open_form')' -new -mdi -modal',
                                    'Open Workspace',
                                    '',     // Initial wildcards
                                    format_list,  // file types
                                    OFN_FILEMUSTEXIST,
                                    WORKSPACE_FILE_EXT,      // Default extensions
                                    '',      // Initial filename
                                    '/home/b04825/projects/',      // Initial directory
                                    '',      // Reserved
                                    "Standard Open dialog box"
                                   );

I save this, and then do Macro->Load Module.  Then I get an error:

Too many arguments.  Add ellipse (...) argument if this function accepts a variable number of arguments

it then puts the cursor at the end of this line in wkspace.e:

            toolbarBuildFilterList(_projecttbTreeGetCurProjectName(treeIndex), treeIndex, AllDependencies);

There are two versions of toolbarBuildFilterList() (file project.e).  One in hotfixes:

int toolbarBuildFilterList(_str projectName,int ProjectIndex=-1,_str (*AllDependencies):[]=null)

and the original:

int toolbarBuildFilterList(_str projectName,int ProjectIndex=-1)

Notice how the hotfix version has the extra argument.  Since I've already applied the hotfix, why isn't Slickedit picking up the right version of project.e?

ScottW, VP of Dev

  • Senior Community Member
  • Posts: 1471
  • Hero Points: 64
Re: Question about hotfixes and how they are applied
« Reply #4 on: June 02, 2011, 08:04:41 pm »
SlickEdit uses a dynamic loading system for macro files. It only knows what is loaded. It never refers back to the original source file. So, you could load files from dozens of different places. You have to know what was loaded and from where, which is why it is important to manage your changes very carefully.

I can't say what's going on with this specific issue. Maybe someone else will have some insights.

I'll file a CR for being able to configure the default directory for Open Workspace.

timur

  • Senior Community Member
  • Posts: 186
  • Hero Points: 3
Re: Question about hotfixes and how they are applied
« Reply #5 on: June 05, 2011, 01:35:20 am »
I've tried this on two different installations, and it doesn't work, so I'm convinced I found a bug.  Here's how to reproduce:

1. Install Slickedit 2011 on a pristine environment (linux x86-64)
2. Install the latest hotfix.  This will create a ~/.slickedit/16.0.0/hotfixes directory.
3. Create a new directory, ~/.slickedit/16.0.0/macros
4. cp ~/.slickedit/16.0.0/hotfixes/wkspace.e ~/.slickedit/16.0.0/macros/
5. Choose Macro->Load Module, and select ~/.slickedit/16.0.0/macros/wkspace.e (no need to edit it)
6. You will see the error, "Too many arguments.  Add ellipse (...) argument if this function accepts a variable number of arguments"

Sandra

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 754
  • Hero Points: 36
Re: Question about hotfixes and how they are applied
« Reply #6 on: June 07, 2011, 07:20:59 pm »
I have included a fix for this issue in the latest version of the cumulative hot fix.  You can find it here:  http://www.slickedit.com/index.php?option=com_content&view=article&id=293.

The problem was that when we process the #imports at the beginning of the file, we check the current directory first, then the installed macros directory.  In your case, wkspace.e was calling a function that was hot fixed, so it needed to find the one in the hot fix directory.

Anyway, I hope that fix makes things a little easier for you, though it's not the feature you wanted.