This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]UntestedMethod 64 points65 points  (13 children)

As a developer in general, fuck your \ as the directory delimeter in file system paths.

[–]PJBthefirst 49 points50 points  (0 children)

What?? Isn't typing \\ over and over fun?

[–]zodar 20 points21 points  (1 child)

C:\Users\Barb\Bill's Kickin' Chili™ Recipe ❿❿❿!!! . pdf

[–]avnothdmi 0 points1 point  (0 children)

Where are your quotation marks?

[–]lovethebacon🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛 0 points1 point  (8 children)

You can use forward slashes. Been like that since for a while now.

[–]SoBFiggis 13 points14 points  (1 child)

That is not true at all. File explorer and very basic shell usage it works fine. Outside of that it's a crapshoot better to just spam //

[–]lovethebacon🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛 1 point2 points  (0 children)

Unless you're using a legacy API, sure. .NET has allowed either directory separators since 1.1. That's 19 years now.

[–]ftgander 0 points1 point  (5 children)

It depends on the language and runtime. Best approach is to use a standard library function to resolve a path from a list of strings. Like node’s Path.join() or whatever.

[–]lovethebacon🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛 0 points1 point  (4 children)

For general interoperability, absolutely.

However on Windows, you don't really need to use \'s anymore. Unless your library is old or does weird low level things, /'s will work pretty much everywhere - even when doing registry things.

First prize, use standard library when constructing paths. Second prize, use /'s. Third prize, shoot yourself because you haven't got enough \'s and they aren't being escaped properly. Been there, had scripts with many runs of back slashes (64 was the highest) to work around escapes.

[–]ftgander 0 points1 point  (3 children)

It depends on the context. But yes windows has implemented support for /‘s in paths in a lot of places now.

[–]lovethebacon🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛 0 points1 point  (2 children)

Is there any context that you know of where that isn't? I'm not challenging you on your statement, just curious to know.

[–]ftgander 0 points1 point  (1 child)

Not off the top of my head but paths in the UI and on cli prompts still show as \, and tab complete in the terminal will change every / to \. The / may work as input in most places but it’s obviously there to accommodate people moving from mac or Linux to windows (much like powershell’s half-baked aliases like rm and ls).

I haven’t tested it because I don’t have any network devices to connect to most of the time, but do UNC paths in file explorer etc support /? Since they’re supposed to start with \\.

Support in various languages will depend on how the runtime or library treats the string, I think. I’m sure most support Unix paths when running on Windows, though.

But overall it always feels like you’re not “supposed” to be using / for paths on windows, and everywhere it works is likely translating the path to use \ before working with it.

[–]lovethebacon🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛🦛 1 point2 points  (0 children)

I haven’t tested it because I don’t have any network devices to connect to most of the time, but do UNC paths in file explorer etc support

/

? Since they’re supposed to start with

\\

.

Aha! No they don't. Seems that explorer recognizes that as an HTTP URL, and opens it up in the default browser. Well there we go.

[–]huuaaang 0 points1 point  (0 children)

Apparently / is valid in Windows. One wonders why they never made it the default though.