I'm “still afraid to use spaces in file names” years old
161–170 of 817 posts
Re: I'm “still afraid to use spaces in file names” years old
#162I work on a complex desktop application, and it's been astounding the number of bugs that have appeared over the years triggered by spaces and other unusual characters in file names. If you do anything with subprocesses or path processing, it's absurdly easy to hit in a thousand different ways, over and over again. Pro tip: rename your development directory (or even better: the workspace path in CI) to put a space an…
A former co-worker changed his name in our auth system to include an apostrophe, so that whenever we handled names wrong he'd find it.
Re: I'm “still afraid to use spaces in file names” years old
#163Re: I'm “still afraid to use spaces in file names” years old
#164I am also that age, and kebab-case is the best case for filenames. 2021-01-01-some-important-document.pdf gives me the warm fuzzies. On the off chance that some more differentiation is needed, throw in an underscore and a whole new world opens up
I go one step further: 2021-11-11_client_project-name.ext 2021-11-11_client_projectName.ext is also OK. But underscore separates fields, hyphens for space replacement.
work/client/project/2021-11-11-file.ext is more or less how I lay stuff out. I’d say client/project is a folder level distinction (arguably dates too).
[EDIT] Realistically most of the stuff under is git repos and I usually make a “home” repo where I keep org files for tracking hours, notes, and resources related to the engagement.
Re: I'm “still afraid to use spaces in file names” years old
#165Earlier quoted context omitted.
Seems like MS had the same idea according to an answer in the link: > Microsoft intentionally made programs install to C:\Program Files on Windows 95+ to force programmers to deal with spaces in filenames.
I wish they did "User Files" instead of "Users" too, because so much software breaks on the home area having a space in it. Not least, it makes writing scripts for various shells and getting the quoting rules right an absolute pain as well...
Re: I'm “still afraid to use spaces in file names” years old
#166Earlier quoted context omitted.
Seems like MS had the same idea according to an answer in the link: > Microsoft intentionally made programs install to C:\Program Files on Windows 95+ to force programmers to deal with spaces in filenames.
Laughs in C:\PROGRA~1\ (try it, still works in Windows 10)
Re: I'm “still afraid to use spaces in file names” years old
#167This is a UI/UX problem that I only face when dealing with shells and shell scripts. Never had any issues when spawning processes from within languages/runtimes that support sane argument arrays. sh , bash and cmd.exe are shit. The shell needs serious rethinking.
This is a difference between $@ and "$@" (note the quotes): $ cat proba.sh #!/bin/sh echo "Using quotes:" for i in "$@"; do echo "$i"; done echo "No quotes:" for i in $@; do echo "$i"; done $ ./proba.sh "ho ho ho" Using quotes: ho ho ho No quotes: ho ho ho
Re: I'm “still afraid to use spaces in file names” years old
#168Earlier quoted context omitted.
Laughs in C:\PROGRA~1\ (try it, still works in Windows 10)
There is no guarantee that the short name has that. In fact on a lot of German Windows installations it was PROGRA~2.
Re: I'm “still afraid to use spaces in file names” years old
#169You should better be very afraid of using spaces in filenames.
You should do everything you can to support them but you have to know you'll invariably encounter countless cases where you'll have this or that tool that won't work properly with them.
I still live in a world where I cannot name a song from the french group L'impératrice with an eacute in the filename or my car's media system will display garbage (it's running QNX and I don't know which filesystem).
FWIW, and it should be food for thought, every single Git repository in the world contains a pre-commit hook sample (disabled by default but it's there) that enforces that every committed file in the repo is named using a subset of ASCII characters.
Every Git repository in the world has that example: let that sink in.
Re: I'm “still afraid to use spaces in file names” years old
#170Earlier quoted context omitted.
> inserting quoting where it's needed You have to remind yourself to do this manually in scripts if you don't want to see lines full of "No such file or directory." One of the reasons the shell is broken is because the character they use as an argument array member separator is something that regular people use to distinguish between two words, such as in a file name.
Well, writing scripts would be much less painful if $VARNAME did not explode into pieces by default. Alas, this ship has sailed long ago.