HFStoPOSIX returning garbled HFS

16 views
Skip to first unread message

andre.tremblay

unread,
Jun 13, 2021, 5:53:42 PM6/13/21
to SuperCard Discussion
Hello Mark, 

Is it normal that when a POSIX file path is passed to HFStoPOSIX(HFSpath) it would return a garbled HPS file path?

For instance:

HFStoPOSIX("/Users/se/Desktop/MySCProj.sc45")

returns: 

/:Users:se:Desktop:MySCProj.sc45

Many thanks

André

MARK LUCAS

unread,
Jun 13, 2021, 6:12:46 PM6/13/21
to superca...@googlegroups.com
Actually that result is technically correct.

Garbage in, garbage out…

-Mark


--
You received this message because you are subscribed to the Google Groups "SuperCard Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to supercard-tal...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/supercard-talk/f26c2d04-08a2-4fb1-966f-10a109641e88n%40googlegroups.com.

André Tremblay

unread,
Jun 13, 2021, 8:05:34 PM6/13/21
to superca...@googlegroups.com
Hello Mark,

Garbage in, garbage out…

Would you have a suggestion to check and/or determine the “nature” of a file path, being an HFS, POSIX or URL?

Regards

André

MARK LUCAS

unread,
Jun 13, 2021, 9:49:59 PM6/13/21
to superca...@googlegroups.com
I could be wrong but off the top of my head I'm not sure there is a 100% reliable way to test whether any arbitrary string is in HFS or Posix format (since technically the forward slash is legal in HFS paths, colons are legal in Posix paths, for partial paths neither character is strictly necessary in either format, and thus a string containing one or the other - or even both - will generally be technically valid when interpreted using both formats).

If you know you're dealing with fully qualified paths though then 99% of the time just checking for a leading slash should yield the desired result. For partial paths then checking whether the string contains a colon or slash is generally the best you can do…

If the file or folder referred to is supposed to already exist though, then most of the time the fact that it doesn't when its path interpreted as one may offer a hint that you should try the other.

Also (not that this helps much in the real world) strings containing consecutive runs of either character are generally illegal in the format which uses it as a delimiter (but not in the other).

-Mark


--
You received this message because you are subscribed to the Google Groups "SuperCard Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to supercard-tal...@googlegroups.com.

rsclavi

unread,
Jul 28, 2021, 11:26:51 AM7/28/21
to SuperCard Discussion
"/Users/se/Desktop/MySCProj.sc45" is a POSIX path - HFStoPOSIX requires a HFS path

put POSIXtoHFS("/Users/se/Desktop/MySCProj.sc45") into msg > Macintosh HD:Users:se:Desktop:MySCProj.sc45

put HFStoPOSIX("Macintosh HD:Users:se:Desktop:MySCProj.sc45") into msg > /Users/se/Desktop/MySCProj.sc45

All the best,

Riccardo
Reply all
Reply to author
Forward
0 new messages