Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^4: OS X troubleshooting help needed - parse filename & open file

by elef (Friar)
on Oct 17, 2010 at 19:01 UTC ( #865828=note: print w/replies, xml ) Need Help??


in reply to Re^3: OS X troubleshooting help needed - parse filename & open file
in thread OS X troubleshooting help needed - parse filename & open file

Well, to be honest, I have no sympathy for people who put lunatic things like quotes in their file names.
I also assumed that quotes weren't allowed in filenames, and I maintain that sane people don't use them even if their OS allows them to.
If you ask me, Windows shouldn't allow accented characters in filenames, either, and I don't particularly mind that the aligner fails on such files.

That said, you are probably right. One issue is that different versions of the various OSes work differently in different circumstances and I don't want to make bold assumptions. E.g. XP seems to always use double quotes, Vista doesn't even allow drag & drop into the console... I'm not sure what Win7 does. For all I know, it might use quotes only if there is a space or other escape-worthy character in the file path. At least one major OS (Ubuntu, I think) does this. I.e. you get /folder/test_file.txt but '/folder/test file.txt'. So the code could easily break if a newer/older OS version works differently or you didn't test thoroughly enough.
Researching all these permutations seemed like too much trouble for the few crazies who use impossible filenames.
  • Comment on Re^4: OS X troubleshooting help needed - parse filename & open file

Replies are listed 'Best First'.
Re^5: OS X troubleshooting help needed - parse filename & open file
by Corion (Patriarch) on Oct 17, 2010 at 19:42 UTC

    So, you want to distribute your program across multiple platforms but don't care whether it works there or not? Why are you asking at all then?

    Note that about every OS (respectively filesytem) nowadays allows "accented characters", and many filesystems have allowed whitespace in filenames and directories a long time.

    It seems to me that you don't have much experience with users, as users like to put whitespace in their filenames and also like to write names as they are properly written instead of asciifying them. It depends on you whether you want to educate your users about how to properly name their files and directories or whether you want your program to just work with what they throw at it.

      So, you want to distribute your program across multiple platforms but don't care whether it works there or not?

      Not quite, I would like it to work everywhere for everyone. But if the user does really unreasonable things and it would take an inordinate amount of effort for me to correct what I consider to be the user's error, well, I leave them with an error message that will hopefully tell them what went wrong. There's also a readme that tells them they shouldn't have done it in the first place. It's not my fault if they didn't read it.

      It depends on you whether you want to educate your users about how to properly name their files and directories or whether you want your program to just work with what they throw at it. Precisely, and in some cases, I do choose the first option. As you can see in the other thread, a bunch of monks failed to come up with a solution for the non-ascii problem in a week of brainstorming, so I called it quits. In the time it would take to sort that mess out (if I ever managed to sort it out at all, which is doubtful), I could probably introduce 5 to 10 other meaningful features instead.
      As I said, I don't get paid to do this, so I can afford to ignore really egregious fringe cases.
      Note: non-ascii characters have indeed been widespread for a long time, but here's an example: if you get a bunch of attached files in Yahoo mail and choose a bulk download, yahoo zips them up for you. Then you unzip the file and find that the non-ascii characters have been corrupted.
      Yahoo is probably the second or third biggest email provider in the world and they don't support non-ascii characters... I think I can get away with doing the same in my hobby project, even though I did attempt to one-up them.

      Spaces are less of an issue. I personally think it's not a good idea to use spaces in a filename, but they don't seem to cause a problem in the aligner.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://865828]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2022-12-05 20:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?