Author Topic: Working directory isn't working  (Read 19888 times)

hs2

  • Senior Community Member
  • Posts: 2738
  • Hero Points: 288
Re: Working directory isn't working
« Reply #15 on: August 01, 2007, 04:22:14 pm »
Confirmed. That didn't change (my Slick history starts at v9) and it shouldn't change.
The only thing which could be an improvement is to enable the 'Change dir' checkbox in the 'Add Files' dialog.

HS2
« Last Edit: August 01, 2007, 04:24:04 pm by hs2 »

dunkers

  • Senior Community Member
  • Posts: 633
  • Hero Points: 28
Re: Working directory isn't working
« Reply #16 on: August 01, 2007, 06:16:50 pm »
What can I say? It happens for me  :o

Tell you what, check out these videos (they're 4MB each but compress to 300K). 12.0.2.zip is ..er.. SE 12.0.2 creating a new project. 12.0.0.zip is the other version doing exactly the same. You can see the difference at the end. I really have no idea why this doesn't happen for you but it does for me, and this is the only way I can think of proving that it does (and demonstrating exactly what I do).

Sorry about the camera shake - my very first recordings :)



Lee

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1299
  • Hero Points: 130
Re: Working directory isn't working
« Reply #17 on: August 01, 2007, 08:09:12 pm »
Nice work.  I think I'm now a fan of sending videos with bug reports.  I was definitely not testing the same way as you were, so I now understand what you are seeing.  Apologies for any misunderstanding.  Add Files/Tree still works the same way I described, the initial directory is still the current directory, as you would see in the when you type cd on the command-line.  Nothing has changed there.  However, a change *did* happen somewhere between 12.0.0 and 12.0.2 in the Choose Directory (_cd_form) works that would have caused this.  In previous builds, when you would browse directories using the ... button on the project form, the working directory would get changed while you were browsing, and this actually lead to some undesirable side effects.  So we did make a change, just not directly to the project properties form. 

What you may want to do is to modify the Add Files callback handler to use the project Working Directory as the initial directory.  In project.e, in _add.lbutton_up() handler (line 4786), you can set the initial directory to the _OpenDialog code from:
Code: [Select]
   typeless result=_OpenDialog("-modal "_stdform("_open_form"),
                      'Add Source Files',// title
                      _last_wildcards,// Initial wildcards
                      def_file_types','EXTRA_FILE_FILTERS,
                      OFN_NOCHANGEDIR|OFN_FILEMUSTEXIST|OFN_ALLOWMULTISELECT|OFN_SET_LAST_WILDCARDS,
                      "", // Default extension
                      ""/*wildcards*/, // Initial filename
                      "",// Initial directory
                      "",
                      "",
                      projectPropertiesAddFilesCallback); // include item callback

to
Code: [Select]
   typeless result=_OpenDialog("-modal "_stdform("_open_form"),
                      'Add Source Files',// title
                      _last_wildcards,// Initial wildcards
                      def_file_types','EXTRA_FILE_FILTERS,
                      OFN_NOCHANGEDIR|OFN_FILEMUSTEXIST|OFN_ALLOWMULTISELECT|OFN_SET_LAST_WILDCARDS,
                      "", // Default extension
                      ""/*wildcards*/, // Initial filename
                      _prjworking_dir.p_text,// Initial directory
                      "",
                      "",
                      projectPropertiesAddFilesCallback); // include item callback

_prjworking_dir.p_text is the edit control which stores the project working directory for that particular project/config.

dunkers

  • Senior Community Member
  • Posts: 633
  • Hero Points: 28
Re: Working directory isn't working
« Reply #18 on: August 01, 2007, 09:40:35 pm »
Thanks, Lee. Some of the stuff I write I don't understand myself when I see it posted  ::) If anyone wants to get into the video thing, I used CamStudio from sourceforge:

http://sourceforge.net/projects/camstudio/

It does swf as well, and I now realise I could've turned the sampling down to sensible levels to make the files smaller.

Quote
What you may want to do is ...

Fantastic, thanks. Sorted me out proper, that has  8)

hs2

  • Senior Community Member
  • Posts: 2738
  • Hero Points: 288
Re: Working directory isn't working
« Reply #19 on: August 02, 2007, 09:42:04 am »
@dunkers: By far the best posting ever [HP++] !

@Lee:
Your proposed solution is just a workaround, right ? IMO it falls short in other situations.
I'd propose to distinguish if the user explicitely changed the project working dir in the dialog (see dunkers' workflow).
In that case the initial dir of the 'Add File' dialog could/should be set to that directory.
In all other cases (e.g. when I'm going to change my current project) the current working dir (means empty initial dir of the dialog) is just fine. And as already mentioned having the 'Change dir' button enabled is also useful.

See attached a modified (see the 'HS2-' comment tags) 'project.e' in case you want verify if it's ok or not.
I tried it myself and it perfectly fits my needs.

HS2

dunkers

  • Senior Community Member
  • Posts: 633
  • Hero Points: 28
Re: Working directory isn't working
« Reply #20 on: August 02, 2007, 09:53:02 am »
Quote
I'd propose to distinguish if the user explicitely changed the project working dir
That sounds reasonable to me, but if the working directory isn't changed it would default to '.', which is effectively the project directory, isn't it? I might be assuming an initial implied cd when the project is created and which doesn't actually occur...

hs2

  • Senior Community Member
  • Posts: 2738
  • Hero Points: 288
Re: Working directory isn't working
« Reply #21 on: August 02, 2007, 10:37:47 am »
Hmm - but this is done (at least in v12.02) ...
There shoud be message on the status bar 'Current directory is ...'.
(project.e updated - missed to remove a 'say' call)

HS2

dunkers

  • Senior Community Member
  • Posts: 633
  • Hero Points: 28
Re: Working directory isn't working
« Reply #22 on: April 18, 2008, 10:26:27 pm »
SE2008 is still using the project directory for loading up the files instead of the working directory where are the files are!

Seriously, I feel like kicking my (new widescreen!) monitor. The thought of having to traverse a zillion directories (again and AGAIN as I select more files) for every **** project I start is just too depressing.

@slickedit: If you're not going to fix this then PLEASE give me the code that will do it. I don't currently have time to mess around trying to get my tools working properly, I just want to use the thing.

------

**** eh? I typed 'd a m n' and the forum replaced that with 'Hoover'
« Last Edit: April 18, 2008, 10:35:01 pm by dunkers »

hs2

  • Senior Community Member
  • Posts: 2738
  • Hero Points: 288
Re: Working directory isn't working
« Reply #23 on: April 19, 2008, 07:12:00 am »
Hi dunkers, did the old v12.0.3 project.e patch work for you ? However, I'd quickly bump it to v13.0.0.
If there is sth. still missing, just tell it. (Since I'm still stuck with v12.0.3 I didn't stumble over it yet...)
Have fun,
HS2
« Last Edit: April 19, 2008, 07:14:40 am by hs2 »

dunkers

  • Senior Community Member
  • Posts: 633
  • Hero Points: 28
Re: Working directory isn't working
« Reply #24 on: April 21, 2008, 12:21:41 am »
I did apply the patch (to 12.0.2) and that must've sorted things for me since I shut up about it. I'm very appreciative of your changes there, but I thought that was a stop-gap until it was fixed properly. If I shut up and change this one also, then next time I do an upgrade we'll go through all this again - it would be far better all round if SlickEdit would do an official fix and then we can forget all about it.

Something weird is happening also. I closed SE and re-opened it then tried adding files to the project to make sure it was still wrong (i.e. it's not waiting for something that gets sync'd when SE is closed/started). Very consistently picking the project directory.

So then I ran up 12.0.2 which opened with an old project, nothing at all to do with the one I'd just created. Imagine my surprise when adding files to this project started in the working directory of the new project! That's some awful cross contamination.

Then I went back to 13.0.0 and the new project, and now adding files to the project opens in the working directory. It looks suspiciously like running 12.0.2 fixed that, but 12.0.2 shouldn't have even an inkling of a sniff of the new project.

hs2

  • Senior Community Member
  • Posts: 2738
  • Hero Points: 288
Re: Working directory isn't working
« Reply #25 on: April 21, 2008, 01:06:43 am »
Strange is a weak word for that ... ???
BTW: Did you notice the (enabled) 'Change directory' checkbox when adding files. Maybe an explanation ?
HS2

dunkers

  • Senior Community Member
  • Posts: 633
  • Hero Points: 28
Re: Working directory isn't working
« Reply #26 on: April 21, 2008, 10:35:46 am »
No CD box - the fix I used is the one proposed by lee (changing the _add.lbutton_up() handler). Since it worked there, and fixes the real problem, I've added it to SE13 too. Not looking forward to SE14 though...

chrisant

  • Senior Community Member
  • Posts: 1410
  • Hero Points: 131
Re: Working directory isn't working
« Reply #27 on: April 21, 2008, 06:07:25 pm »
I agree it would be great to see certain of the informal patches from the forums make it into the real product.

To insulate me from upgrade complications, I keep my entire SlickEdit installation under source control as two separate trees:  (1) the stock unmodified SlickEdit installation tree, and (2) a customized installation tree with my macros and patches, etc.  When I upgrade to a new version of SlickEdit (or even when I download hotfixes), I install over the "Slick_Unmodified" tree.  Then I merge the changes from the "Slick_Unmodified" tree into the "Slick_Custom" tree.  If you happen to use Perforce as your source control system (which by the way is free for single user use, last I knew) then it's just a matter of using the "p4 integrate" and "p4 resolve" commands.

The net result is that all the patches I made to v12.0.3 survived the upgrade to v13.0.0.  The down side is that I can't use the "install hotfix" feature directly, instead I have to install hotfixes to the Unmodified tree and then merge them into my Custom tree.

Hope that procedure helps someone.
Cheers,
Chris

dunkers

  • Senior Community Member
  • Posts: 633
  • Hero Points: 28
Re: Working directory isn't working
« Reply #28 on: April 21, 2008, 07:03:39 pm »
That's worth thinking about. I can see a problem where a fix to one version of SE is inappropriate in another version, but at least it's an easy way to see that a change was made (and what it was!).

Given that SE doesn't use the registry, couldn't you run the original copy to do the hotfix? The config file location would need changing, of course, but it should be a one-off job.

chrisant

  • Senior Community Member
  • Posts: 1410
  • Hero Points: 131
Re: Working directory isn't working
« Reply #29 on: April 21, 2008, 07:48:01 pm »
I can load hotfixes in the Unmodified tree, yes.  Can't really do that directly in the Custom tree, else when the hotfixes modules are loaded they replace the customized modules.  E.g. if you make a bunch of changes to "c.e", and a hotfix comes out for "c.e", then loading the hotfix effectively undoes your custom changes.  There are two "c.e" files:  the customized one, and the hotfixed one.  You can load one or the other, but you must merge them if you want both your customizations and the hotfix changes to be active at the same time.

If the trees are under source control, then it's appropriate to apply hotfixes in the Unmodified tree and merge them into the Custom tree.  I wouldn't want to apply hotfixes directly to the Custom tree, it just messes stuff up.