Author Topic: Relative project member file calc fails when "/mnt" is only common component  (Read 182 times)

os2bird

  • Senior Community Member
  • Posts: 114
  • Hero Points: 13
This could be an older issue, but it happens with beta 1 and beta 3 on linux.

I'm creating a project "MacMiniM1-VMM.vpj" (type 'Other') in a new "/mnt/scratch/vbox/slickedit/test1/" directory.  However, the source tree I add to the project is in a very different place: "/mnt/macmini-m1/scratch/vbox/svn/trunk/src/VBox/VMM/".  When project + workspace is created and opened, it's empty. Looking into the "Project Properties" it lists "/macmini-m1/scratch/vbox/svn/trunk/src/VBox/VMM/*" in the project files list.  The "/mnt" part of the path is gone.

If I try correct the issue by the "Remove All" and "Add Tree" buttons, I navigate to the directory and add it again. Same thing, no leading "/mnt/".  Doesn't matter what I add under /mnt/, as long as it isn't in "/mnt/scratch". However, if I for instance try add "/mnt/scratch/src/bash/bash-2.0/" (using the "Add Tree" button), it works and shows up as "../../../src/bash/bash-2.0/*.*".

My guess is that this is an issue with the relative path calculation, where it somehow doesn't add the "../../../.." prefix.

- bird

P.S. the "Properties..." button in the "Project Properties" dialog hangs / locks slickedit here on my linux box and I have to do a "killall -9 vs_exe" to get rid of it.

os2bird

  • Senior Community Member
  • Posts: 114
  • Hero Points: 13
Seems the root of the problem is the relative() function (again linux/amd64 host, beta3):
Code: [Select]
say("good: " :+ relative("/mnt/scratch/whatever",  "/mnt/scratch/vbox"));
say("bad1: " :+ relative("/mnt/whatever",  "/mnt/vbox"));
say("bad2: " :+ relative("/whatever",  "/vbox"));

Results in:
good: ../whatever
bad1: /whatever
bad2: /whatever


All the paths returned should be the same ("../whatever").
« Last Edit: September 22, 2023, 09:01:26 AM by os2bird »

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6688
  • Hero Points: 514
Fixed for beta 4. Thanks for finding this. This does look like an old bug.

relative("/mnt/whatever","/mnt/vbox")==/whatever ---  definitely wrong

relative ("/a", "/b")==/whatever  -- This is sort of ok but will change to ../whatever in beta 4.

Here's how you know for certain whether relative is returning a bad value.

The following has to work:

absolute(relative(absolute-filename,toDirectory),toDirectory)==absolute-filename

This is how you know relative("/mnt/whatever","/mnt/vbox")==/whatever is WRONG. The bug is that it's using some logic which can only be applied on Windows but not Unix/Linux/macOS.

os2bird

  • Senior Community Member
  • Posts: 114
  • Hero Points: 13
Thanks. I'll give it a test when beta 4 becomes available.