<selitem> and "\"

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
Filehero
Posts: 2734
Joined: 27 Feb 2012 18:50
Location: Windows 11@100%

<selitem> and "\"

Post by Filehero »

Hi,

is there a tweak I've missed?
Why does <selitem> returns the tailing "\" for drives (the root folder) but not for child folders? It's the same with Files > To Clipboard > Item Path/Names.

The behavior should be the same, shouldn't it?

jupe
Posts: 3477
Joined: 20 Oct 2017 21:14
Location: Win10 22H2 120dpi

Re: <selitem> and "\"

Post by jupe »

I think this could possibly be because of:
slashed.png
screenshot taken of the XYplorer help file.
To see the attached files, you need to log into the forum.

Filehero
Posts: 2734
Joined: 27 Feb 2012 18:50
Location: Windows 11@100%

Re: <selitem> and "\"

Post by Filehero »

Hi Jupe,

thanks for the possible explanation. Another legacy Windows awkwardness, it seems.

admin
Site Admin
Posts: 66719
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: <selitem> and "\"

Post by admin »

Filehero wrote:Hi Jupe,

thanks for the possible explanation. Another legacy Windows awkwardness, it seems.
OK, but shouldn't XYplorer variables return something that has some consistency? I think all paths should be returned unslashed.

And, if you are in C: this returns "C:" unslashed:

Code: Select all

echo <curpath>;
But if I'd change it now, would I break old code? Probably... :(

Filehero
Posts: 2734
Joined: 27 Feb 2012 18:50
Location: Windows 11@100%

Re: <selitem> and "\"

Post by Filehero »

admin wrote: OK, but shouldn't XYplorer variables return something that has some consistency? I think all paths should be returned unslashed.
Yes, hence my question.
admin wrote: But if I'd change it now, would I break old code? Probably... :(
Unfortunately, yes. Perhaps a tweak?

admin
Site Admin
Posts: 66719
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: <selitem> and "\"

Post by admin »

Given that usually xy variables and environment variables return paths without a trailing slash, and I know for sure that this is intended and coded in many places in the program, I would classify this as a bug, which means I should just fix it.

Any objections?

highend
Posts: 15004
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: <selitem> and "\"

Post by highend »

But this change will break scripts as well...

And if you really do it, don't forget that some shell context menus do the same:
To Clipboard - Item Path(s) comes to my mind...
One of my scripts helped you out? Please donate via Paypal

admin
Site Admin
Posts: 66719
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: <selitem> and "\"

Post by admin »

Damn, you are right.

Post Reply