SlickEdit Product Discussion > SlickEdit®

vs "-#cd dir" from the command shell

(1/1)

sbusch:
If you see attached, from a DOS shell, vs "-#cd c:\tmp\tmp", correctly changes the cwd in the Open window. However, it does *not* change the cwd in the Open dialog, nor is it correct doing an open via CUA ctrl-O. However, ESC > cd c:\tmp\tmp, does work as I would like, i.e., it changes the cwd in all places.

So, my questions are:
1. Is the DOS behavior as expected?
2. If it is, then is there a command that changes the cwd "everywhere"?

Thanks

hs2:
@sbusch: I've written this little helper to do a sync'd cd.
You may add it to your vsusrmacs.e / sbusch.e macro collection.


--- Code: ---_command void cdb(_str newdir='') name_info(',' VSARG2_REQUIRES_MDI_EDITORCTL|VSARG2_READ_ONLY|VSARG2_ICON)
{
   if (newdir == '') newdir=strip_filename (p_buf_name,'N');

   if ( last_char (newdir)==FILESEP ) newdir=substr (newdir,1,length (newdir)-1);
   if ( (newdir != '') && (getcwd () != newdir) )
   {
      // HS2: dbg
      // say ( "cdb (): Change directory '" getcwd () " -> '" newdir "'" );
      cd (newdir, 'm');
      // HS2: added to sync with 'Open' tab in project toolbar and process buffer
      _cd_tbopen ();
      _process_cd (newdir);
   }
}

--- End code ---

Have fun,

HS2

sbusch:
Thanks for code! However I should have qualified this (my bad) by "se is already loaded". You command in fact works perfectly if se is not resident. However, if se is resident, your command exhibits the same behavior as cd: it doesn't effect File > Open nor ESC > cd.

The whole rationale behind this is that I'm navigating all over the place (10 or so directories) with a Unix like (MKS Toolkit) command shell that's extraordinarily powerful (duh, say the Linux crowd  ;D) and that I'd like se to change its cwd accordingly. BTW, this is also why I'd like to able to say "cd $HOME" in se because this what you'd do in a Unix shell. Wicked powerful.

e.g.,
function se
{
   typeset OPTS="";

   while [ $# -gt 0 ]; do
       case $1 in
      -n) OPTS="-#close_all"; shift;;
      -d) OPTS="-#cdb $PWD"; shift;;
      *)  break;;
      esac
   done

   $VISUAL "$OPTS" $*
}


Steve

Navigation

[0] Message Index

Go to full version