Author Topic: Procedure associated_file_exists not found.  (Read 1080 times)

flethuseo

  • Senior Community Member
  • Posts: 170
  • Hero Points: 2
Procedure associated_file_exists not found.
« on: April 30, 2015, 11:01:41 pm »
Hi all,

I want to create the following macro with an already existing function,
but it cannot find it; I get this error:

Code: [Select]
  Procedure associated_file_exists not found.
Code: [Select]
    #include "slick.sh"

        _command void edit_associated_ruby()
        {
            _str filename = strip_filename(p_buf_name, 'N');
            // extract the extension
            _str extension = _get_extension(filename);
            filename = _strip_filename(filename, 'E');

            if (!associated_file_exists(filename, "xml", returnAll)) {
                filename = "";
            }

            // edit the file
            if (file_exists(filename)) {
                edit(maybe_quote_filename(filename),EDIT_DEFAULT_FLAGS);
                message("Found: " filename);
            } else {
                message("No match found");
            }
        }

I tried including stdcmds.e but I get another error.

Graeme

  • Senior Community Member
  • Posts: 1949
  • Hero Points: 225
Re: Procedure associated_file_exists not found.
« Reply #1 on: May 01, 2015, 12:37:36 pm »
The function is static so you can't call it.  Just copy the entire function out of stdcmds.e into your own file and rename it my_associated_file_exists or something.

flethuseo

  • Senior Community Member
  • Posts: 170
  • Hero Points: 2
Re: Procedure associated_file_exists not found.
« Reply #2 on: May 03, 2015, 05:18:41 pm »
Hmm I didn't want to do that. If I do that, I have to copy a bunch of other static functions that are called by that very function.

Graeme

  • Senior Community Member
  • Posts: 1949
  • Hero Points: 225
Re: Procedure associated_file_exists not found.
« Reply #3 on: May 04, 2015, 02:07:17 am »
Did you actually try it?  I tried it before my last post and it compiled fine without copying any other static functions.