ouch icon indicating copy to clipboard operation
ouch copied to clipboard

Don't use absolute paths

Open marcospb19 opened this issue 4 years ago • 4 comments

We can remove the fs::canonicalize function calls, as they are only being currently used to check if files exist, this type of check should be performed with fs::metadata instead.

This is currently causing the problem that our error messages have the absolute paths, some workaround functions could even be removed, like strip_cur_dir simplifying our code.

Example of absolute path in error messages:

image

marcospb19 avatar Nov 10 '21 23:11 marcospb19

I'll take a shot at fixing this.

marcospb19 avatar Nov 11 '21 19:11 marcospb19

Hey marcospb19, are you still working on this?

SpyrosRoum avatar Apr 06 '22 08:04 SpyrosRoum

Sadly not, I didn't even start it, I think this requires a medium refac just because it might break other parts of the code.

marcospb19 avatar Apr 06 '22 19:04 marcospb19

So, just to document this, the naive fix for this is breaking the whole project, further investigation is necessary :v .

We do however have a function called strip_cur_dir, so it's possible to fix the problem with long canonicalized paths, so AFAIK this issue is not a huge deal right now.

I'll be removing it from the next milestone.

marcospb19 avatar Jun 08 '22 21:06 marcospb19

I don't think this does make sense anymore, canonicalized is only called for files passed as CLI args, not unpacked files.

There seems to be no clear benefit to this, it would require reviewing a lot of code to check for errors, and it possibly introduces some bugs because the whole codebase expects input file paths to be absolute.

marcospb19 avatar Feb 07 '23 15:02 marcospb19