Platform-specific file path delimiters

Richard Gaskin ambassador at fourthworld.com
Wed Sep 23 15:02:04 EDT 2015


Roger Eller wrote:

> On Sep 23, 2015 1:32 PM, "Mark Waddingham" wrote:
>>
>> On 2015-09-23 18:53, Richard Gaskin wrote:
>>>
>>> A regression with UNC paths was recently fixed:
>>> <http://quality.runrev.com/show_bug.cgi?id=15814>
>>>
>>> Most interesting to me there is that it allows the use of the
>>> Windows-specific "\" as a file path delimiter.
>>
>> This is very much a case of 'unintended consequences' or 'just because
>> you can do something, it doesn't mean you should' (and why maintaining,
>> updating, evolving the engine whilst retaining backwards compatibility can
>> be very very difficult at times).
>
> Since I didn't have the good fortune of being personally tutored by the
> creator of MetaCard, and am primarily a Windows user, when I pasted a UNC
> path and "it just worked", I was like WOW, those runrev guys have really
> made this Revolution thing super easy for the novice.  Go team!

It's nice when it works like that.  I started using MC on Mac Classic, 
and I ran into path issues early on because IIRC no such accommodation 
was made for the Mac-specific ":" delimiter.   Rather than read the docs 
I wrote to Dr. Raney, who referred me to the docs.

For current users, the LiveCode User Guide section on File Name 
Specifications and File Paths includes this brightly-colored callout on 
page 323:

    Important: Each platform has its own way for programmers to
    specify file paths. The file path shown above is in the usual
    style for file paths on Unix systems. For cross-platform
    compatibility, LiveCode uses this same forward slash /
    character in its file path regardless of the current platform.
    This way, you can generally specify file and work with paths
    in your scripts without having to convert them when you switch
    platforms.

So it looks like we're covered:  anyone looking for cross-platform info 
can find what they need, and Windows-specific work is still supported 
using Windows-specific path delimiters.


>>> I didn't know OS-specific delimiters could be used.
>>
>> That's good - you shouldn't use them - it would probably be best that
>> everyone forgets that you can, and try to ensure you don't use them
>> anywhere in new applications :)
>
> Please announce this on first run if the OS isn't *nix based, or warn in
> the script editor.

Why would that be necessary if Windows-specific paths are supported, as 
Mark just described above?

Cross-platform development requires learning.  If we were to put all the 
multi-platform accommodation into a first-run dialog (file paths, menu 
bar management, document associations, shortcut key equivalents, fonts, 
and a whole lot more) that dialog would be about 378 pages long - the 
size of the User Guide.  Probably best left in the Help menu where it is. :)

-- 
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  Ambassador at FourthWorld.com                http://www.FourthWorld.com




More information about the use-livecode mailing list