[Suggestion]: Use forwardslash everywhere

Discussion related to "Everything" 1.5 Alpha.
Post Reply
DerekZiemba
Posts: 44
Joined: Thu Sep 27, 2018 4:46 pm

[Suggestion]: Use forwardslash everywhere

Post by DerekZiemba »

To use forward slash everywhere so that backslash can be used for escaping.
  • Display all paths with forward slash
  • When a path is pasted, auto-convert backslash to forward slash (unless backslash is escaped with backslash in front of it)
  • When a path is copied, use the forward slash representation.
    • Already works fine in Explorer
    • Works fine in every shell/terminal except cmd & that's being replaced by pwsh anyway.
    • Works in browsers
    • As a dev, I won't have to manually convert to forwardslash when pasting into a JSON file, etc.
  • Perhaps, to simplify things, go as far as making the internal path representation always be forward slash & converting as needed when interacting with win32 APIs.
Once that's settled, do what every other normal program does and use backslash as an escape hatch. Could then potentially open up more advanced globbing, with `\` escaping the literal representation

----------------------
However In the meantime, simpler things:
  • Add a setting to copy paths with forward slashes.
    Or to copy with backslashes already escaped, ie: `C:\\Windows\\System32\\some\\folder`
  • Some way to glob for numbers.
    • I'd suggest `#` but that's a valid path character.
    • `:` is unused but may conflict with the macro/property system.
    • `< | >` already work nicely (in the search bar, not sure if it works everywhere though like the Index Exclude List).
    • This leaves `"` as the only remaining invalid path character, but is already used to group things with spaces in them.
      But... If there was an escape char `\`.... a lot of options open up
horst.epp
Posts: 1456
Joined: Fri Apr 04, 2014 3:24 pm

Re: [Suggestion]: Use forwardslash everywhere

Post by horst.epp »

WE are in a Windows environment, which clearly uses \ for paths.
There are enough other ways to escape some characters without changing fundamental things.
void
Developer
Posts: 17152
Joined: Fri Oct 16, 2009 11:31 pm

Re: [Suggestion]: Use forwardslash everywhere

Post by void »

I have put on my TODO list to add an option to convert \ to /

I will consider more globbing options and \ escaping.

Thank you for the suggestions.
therube
Posts: 5056
Joined: Thu Sep 03, 2009 6:48 pm

Re: [Suggestion]: Use forwardslash everywhere

Post by therube »

Just to note, some places/actions in Everything are already ambidextrous (accepting either or) /\.

When a path is copied, use the forward slash representation.
For a copy operation, was there already an option for that?
Such that display would be \, but paste would be / (or was that something different). [Must have been different. Nope, it's there.]
file_copy_full_path_with_forward_slashes_keys=


Works fine in every shell/terminal except cmd
Suppose it's possible you could run into other third party programs that, lets say, use funky operations for Open boxes or whatnot where / might not be accepted, or where a programs command-line options will not work with a path of, /paths/to.somewhere/abc.txt.

globbing
Can be tricky (to get it right).


And \\ can be ugly for one to look at (well, at least for me).
image.png
image.png (305.16 KiB) Viewed 1121 times
meteorquake
Posts: 523
Joined: Thu Dec 15, 2016 9:44 pm

Re: [Suggestion]: Use forwardslash everywhere

Post by meteorquake »

I suspect what's needed is a universal setting that affects everything, that can then be tied to a shortcut (directly or via bookmark).
So whenever you need / or \\ or any other format you hit the shortcut and everything changes to that. You do whatever you need e.g. copying then hit a shortcut to return back to your default preference. Doing the same shortcut twice could toggle.
d
void
Developer
Posts: 17152
Joined: Fri Oct 16, 2009 11:31 pm

Re: [Suggestion]: Use forwardslash everywhere

Post by void »

For a copy operation, was there already an option for that?
Such that display would be \, but paste would be / (or was that something different). [Must have been different. Nope, it's there.]
file_copy_full_path_with_forward_slashes_keys=
Use the UI to set a hotkey for File | Copy Full Path With Forward Slashes:
  • In Everything 1.5, from the Tools menu, click Options.
  • Click the Keyboard tab on the left.
  • To the right of Show commands containing, search for:
    copy
  • Select: File | Copy Full Path With Forward Slashes
  • Click Add....
  • Press a new keyboard shortcut (for example: Ctrl + Shift + C) and click OK.
  • Click OK.
A few issues I've found with converting \ to / are:
The shell doesn't like / (path to PIDls APIs don't work, so things like context menus are broken)
Windows doesn't like // UNC paths.
Common open dialogs do not like / in paths.

If I do add a option to convert \ to / it will be a display and copy option only.
void
Developer
Posts: 17152
Joined: Fri Oct 16, 2009 11:31 pm

Re: [Suggestion]: Use forwardslash everywhere

Post by void »

There is a wildcard: search modifier that offers:

* = Matches any character zero or more times.
? = Matches any single character (including / or \).
# = Matches any single digit (0-9).
[ ] = Matches any one of the characters specified in the set.
[! ] = Matches any one character that is not specified in the set.
\ = Escape the following character. C escapes supported. (treat the following character as literal)



-I have put on my TODO lists to treat / and \ as the same when searching filenames with wildcard:
DerekZiemba
Posts: 44
Joined: Thu Sep 27, 2018 4:46 pm

Re: [Suggestion]: Use forwardslash everywhere

Post by DerekZiemba »

horst.epp wrote: Thu Nov 21, 2024 7:46 pm WE are in a Windows environment, which clearly uses \ for paths.
There are enough other ways to escape some characters without changing fundamental things.
Such as? Invalid filename characters are ` \ / : * ? " < > | ` so you pretty much have to pick from that set.
therube wrote: Fri Nov 22, 2024 5:33 pm Just to note, some places/actions in Everything are already ambidextrous (accepting either or) /\.
When a path is copied, use the forward slash representation.
For a copy operation, was there already an option for that?
Such that display would be \, but paste would be / (or was that something different). [Must have been different. Nope, it's there.]
file_copy_full_path_with_forward_slashes_keys=
Ahh, I missed that. It doesn't show up in Options -> Advanced menu. But I do see it in the config file.
EDIT: So that's just a hotkey setting with the value being a bitmask of the form
(InResultList<<14) | (InSearchEdit<<13) | (WinKey<<12) | (Shift<<11) | (Alt<<10) | (Ctrl<<9) | (255 & VK_KEY)

therube wrote: Fri Nov 22, 2024 5:33 pm
Works fine in every shell/terminal except cmd
Suppose it's possible you could run into other third party programs that, lets say, use funky operations for Open boxes or whatnot where / might not be accepted, or where a programs command-line options will not work with a path of, /paths/to.somewhere/abc.txt.
The issue I most often run into is actually the opposite, with most programs requiring forward_slash. If not, usually the app will use Win32 controls which already supports forward_slash.

There is the following settings. I have them enabled for consistency & to make sure my macros/filters/defined functions don't run into bugs (I've had issues before).
convert_forward_slash_to_backslash=1
convert_regex_forward_slash_to_double_backslash=1

I'd prefer options for the opposite though, akin to:
convert_backslash_to_forwardslash_onpaste=1
convert_backslash_to_forwardslash_oncopy=1
display_paths_using_forwardslash=1

or, using the existing setting keys:
convert_forward_slash_to_backslash=2 // where 2 = convert the other direction
convert_regex_forward_slash_to_double_backslash=0 // no touchy my regexpressions
Last edited by DerekZiemba on Tue Nov 26, 2024 5:36 pm, edited 3 times in total.
DerekZiemba
Posts: 44
Joined: Thu Sep 27, 2018 4:46 pm

Re: [Suggestion]: Use forwardslash everywhere

Post by DerekZiemba »

void wrote: Tue Nov 26, 2024 8:51 am There is a wildcard: search modifier that offers:

* = Matches any character zero or more times.
? = Matches any single character (including / or \).
# = Matches any single digit (0-9).
[ ] = Matches any one of the characters specified in the set.
[! ] = Matches any one character that is not specified in the set.
\ = Escape the following character. C escapes supported. (treat the following character as literal)

-I have put on my TODO lists to treat / and \ as the same when searching filenames with wildcard:

Ahh, I had no idea that modifier changed behavior in that way. I've always assumed there were always wildcards, just limited to `*`, `**`, & `?` and that the modifier was more of a way to toggle the behavior on & off. I had no idea it expanded the wildcard matching.

That pretty much took care of my wildcard use case. Awesome!
I won't have to rely on regex as much. Hopefully use less of the ugly pattern
(parent|paths)\\(?:[^\\]+\\)+?((subfolders)|((file|names)\.[a-z0-9]{1,6])|([^\\]+\.(file|extensions)))$
.
BTW, are there any perf benefits to wildcards vs regex? Or is it just converted to regex behind the scenes anyway?
Last edited by DerekZiemba on Tue Dec 03, 2024 7:15 pm, edited 1 time in total.
meteorquake
Posts: 523
Joined: Thu Dec 15, 2016 9:44 pm

Re: [Suggestion]: Use forwardslash everywhere

Post by meteorquake »

I can say from VBA that the simple wildcard "Like" function is vastly faster than the Regex function, which becomes important when it has to be applied millions of times. I have a vague memory of measuring it many years back and it being 10x as fast although the "Like" function was a direct part of the language whilst the Regex was used via an object although that shouldn't have accounted for the speed difference. d
void
Developer
Posts: 17152
Joined: Fri Oct 16, 2009 11:31 pm

Re: [Suggestion]: Use forwardslash everywhere

Post by void »

Everything has it's own wildcard engine.

regex:^foo.$ on 1 million files: ~0.039 seconds
wildcard:foo? on 1 million files: ~0.002 seconds

regex:f.*o.*o on 1 million files: ~0.039 seconds
wildcard:*f*o*o* on 1 million files: ~0.012 seconds

You might see better regex performance if you use 10 or more *'s
meteorquake
Posts: 523
Joined: Thu Dec 15, 2016 9:44 pm

Re: [Suggestion]: Use forwardslash everywhere

Post by meteorquake »

That's certainly a good speed for both.
It would probably become significant if for each file you had a need to sub-lookup using pattern-matching.
David
therube
Posts: 5056
Joined: Thu Sep 03, 2009 6:48 pm

Re: [Suggestion]: Use forwardslash everywhere

Post by therube »

a lot of programs are slash agnostic
accepting either / or \

but there can be gotchas as far as how far "accepting" they are ;-)

so anyhow, i'm running a hash on files, & it is taking a LONG time
4:46 & counting, 72% complete [completed in > 5 hours]

btw, i love /, & use them everywhere i can

& i come to realize that while the program accepts either / or \
/depending/ on the slash used at the basename part of the path
certain parts of the program may or may not function (correctly)

like, in this case, the Save As function (which brings up a plain
jane [or at least plane jane to me] windows "Save As" dialog

if \basename, dialog works
if /basename, dialog does not work

now, is that a failure of the program, or a function of Windows?
don't know (offhand), don't particularly care
(i'm on Win7, in case that should matter)

upon realizing that, my MIND immediately goes into - UH OH mode!
i DID start the program via the command line, & as i love /,
WHAT DID I DO ?

[so i jump to my console window]
& for whatever (& that whatever being that i most likely
pasted the path, copied from Everything, of course,
into the command line) reason, it happened to have BACKWARDS
slashes (\ slashes have always been backwards to me)

sigh.

anyhow, had i happened to use / in the path, i would not have
been able to Save As my 4 hours & counting work

(now, in the end, that will be all for not, as i've come
across other "gotchas". well not ALL, but for some 1% of
the files in question, i will not have results)

CHK accepts forward slashes in paths, from the command line, but...
void
Developer
Posts: 17152
Joined: Fri Oct 16, 2009 11:31 pm

Re: [Suggestion]: Use forwardslash everywhere

Post by void »

Everything 1.5.0.1388a improves wildcards:

When using wildcards: without a function:
ie: when applying wildcards: to a filename

/ will now match: \
* will now match any character except / or \
** will now match any character.
void
Developer
Posts: 17152
Joined: Fri Oct 16, 2009 11:31 pm

Re: [Suggestion]: Use forwardslash everywhere

Post by void »

wildcards: in Everything 1.5.0.1389a will now obey the star-all: search modifier and wildcards_star_all advanced setting when searching filenames.
Post Reply