Author Topic: Suggestion: Open containing folder.  (Read 3984 times)

tomek

  • Community Member
  • Posts: 9
  • Hero Points: 0
Suggestion: Open containing folder.
« on: April 23, 2009, 06:11:58 pm »
With the latest version of SlickEdit I often find myself using "e <file_name>" command to open files. When I open files this way the open tool window does not show the containing folder and sometimes I would like to be able to sync up the current directory. (ex: when building parts of the tree) Is there already a command that will do this for me? Maybe we can add another menu item to the file tab "Open containing folder"


Phileosophos

  • Community Member
  • Posts: 35
  • Hero Points: 0
Re: Suggestion: Open containing folder.
« Reply #1 on: November 15, 2011, 05:16:08 pm »
I don't see that this topic was ever addressed. It sounds like a very welcome feature. Has it been implemented since the original post? Thanks in advance.

ehab

  • Senior Community Member
  • Posts: 285
  • Hero Points: 15
  • coding with SE is like playing music
Re: Suggestion: Open containing folder.
« Reply #2 on: November 15, 2011, 06:43:37 pm »
did you see

Tools > Options > File Options > Open

and maybe try
Switch current directory ... true

Phileosophos

  • Community Member
  • Posts: 35
  • Hero Points: 0
Re: Suggestion: Open containing folder.
« Reply #3 on: November 15, 2011, 06:48:09 pm »
Yes, I did, thanks. I'm looking for something more selective, however, that doesn't change directory on me every time I switch files.

ehab

  • Senior Community Member
  • Posts: 285
  • Hero Points: 15
  • coding with SE is like playing music
Re: Suggestion: Open containing folder.
« Reply #4 on: November 15, 2011, 07:28:14 pm »
then its about time you enter the wonderful world of macros :D

Sandra

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 754
  • Hero Points: 36
Re: Suggestion: Open containing folder.
« Reply #5 on: November 15, 2011, 07:50:26 pm »
There was actually a macro entered into the recent macros competition that did this very thing.  It was a command that you run as needed to sync the current directory to whatever directory the current file is in.

Here's the thread:  http://community.slickedit.com/index.php/topic,7336.0.html

You can tweak this to suit your needs and then add it to a menu.  There is lots of info in the SlickEdit help about writing macros and editing menus.  Plus, the forums are full of helpful and knowledgeable users.  Good luck!

Phileosophos

  • Community Member
  • Posts: 35
  • Hero Points: 0
Re: Suggestion: Open containing folder.
« Reply #6 on: November 15, 2011, 08:56:22 pm »
Interesting. I actually solved the problem myself, or seem to have via a macro, but I wonder why mine is so different from his. For those who are interested, the code follows here:

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

// The following macro changes the current working directory to where the current
// buffer's file resides.

_command void cdbuffer() name_info(','VSARG2_READ_ONLY)
{
   _str newdir=strip_filename(p_buf_name, 'N');
   cd(newdir);

   message("Changed directory: " :+ newdir);
}