Author Topic: Change working directory from the command line doesn't work  (Read 4119 times)

lynchpancho

  • Junior Community Member
  • Posts: 3
  • Hero Points: 0
Change working directory from the command line doesn't work
« on: February 15, 2008, 04:28:57 pm »
We have a scripted build system where we launch makes from different command windows to build components.  I'm always navigating around to different very long and nasty paths.  It would be nice to issue vs "-#cd ." and have it switch slickedit to the current directory.  It looks like this is partially working because it does display the current path over the command window but it doesn't actually switch the working directory :(

hs2

  • Senior Community Member
  • Posts: 2747
  • Hero Points: 289
Re: Change working directory from the command line doesn't work
« Reply #1 on: February 15, 2008, 05:18:12 pm »
Try 'cd +p .' (@see Help>Index: cd). This should help. - HS2

lynchpancho

  • Junior Community Member
  • Posts: 3
  • Hero Points: 0
Re: Change working directory from the command line doesn't work
« Reply #2 on: February 18, 2008, 02:57:47 pm »
Thanks for the info.  I tried it but that doesn't seem to work.  I'm trying to get the same functionality from menu selection File->Change Directory but initiated from the cmd line. 

hs2

  • Senior Community Member
  • Posts: 2747
  • Hero Points: 289
Re: Change working directory from the command line doesn't work
« Reply #3 on: February 18, 2008, 03:14:38 pm »
How do you recognize that the cwd is not the right one ?
What exactly are you trying to do ?
What's the value of your 'def_cd' variable ? ('set-var def_cd' an cmdline / 'Macro>Set Macro Variable')
Sorry, w/o knowing some more details it's hard to give an appr. advise.
HS2

Lee

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1299
  • Hero Points: 130
Re: Change working directory from the command line doesn't work
« Reply #4 on: February 18, 2008, 03:31:08 pm »
When SlickEdit is running and an command-line invocation occurs (without the +new switch), the running version has to parse out the command-line options and try to do the right thing, open files and execute macros passed on the command-line.  To do this, the current working directory is changed to match the working directory of the invocation, and then the working directory is restored.  The restoration of the working directory is what is preventing your particular case from working.

There is a macro command that handles this, the dde command is located macros/files.e.  I am hesitant to make any changes to this command, because many people currently expect it work this way and I want to make sure that it would behave correctly for everyone.

lynchpancho

  • Junior Community Member
  • Posts: 3
  • Hero Points: 0
Re: Change working directory from the command line doesn't work
« Reply #5 on: February 18, 2008, 06:24:32 pm »
OK, I understand.  Is it possible to overwrite the value that is restored by editing this macro with the value that is passed in the cd command line?  That way it only tweaks the value when a user specifically requests a CD, else it acts exactly the same way.  Does this macro have access to the command line strings?