Author Topic: Getting path where a command was loaded from  (Read 3475 times)

flethuseo

  • Senior Community Member
  • Posts: 177
  • Hero Points: 2
Getting path where a command was loaded from
« on: October 20, 2016, 09:54:29 PM »
Hi,
I want to be able to get the path for the ruby script which is the same directory from which the *.e file was loaded from. Right now, I'm forced to use an absolute path, but I want to make this a relative path. Is this possible?

Code: [Select]
#include "slick.sh"

_command void rmv_c_dev() {

   if (_select_type() == "") {
      select_all()
   } else if (_select_type() != "LINE" && _select_type() != "BLOCK") {
      // Convert it into a LINE selection
      _select_type('', 'T', 'LINE');
   }

   // This doesn't run correctly if I don't supply the full path, I want to detect the path of this script.
   _str cmd = 'ruby C:\Users\Ted\SlickEdit\MyMacros\rmv_c_dev\rmv_c_dev.rb'
   _str out = filter_command(cmd);
// say('cmd='cmd);
}

Graeme

  • Senior Community Member
  • Posts: 2796
  • Hero Points: 347
Re: Getting path where a command was loaded from
« Reply #1 on: October 21, 2016, 11:58:18 AM »
You could have a read of this
https://community.slickedit.com/index.php/topic,9792.msg41781.html#msg41781

You can get the path for your configuration folder using _config_path().