AW: Platform-specific file path delimiters

Mark Waddingham mark at livecode.com
Thu Sep 24 07:29:51 EDT 2015


On 2015-09-24 13:21, Tiemo Hollmann TB wrote:
> Good to know!
> 
> Though I knew, that I could have only used "/" for all platforms, I 
> always
> put lots of effort in setting platform specific slashes in every case,
> because of "nicer" error messages for the end user.
> If you are building a path like specialFolderPath("sdat") & slash & 
> myFolder
> etc. and get back any kind or error like path/file not found, on 
> windows it
> will look like "C:\ProgramData/myFolder/etc", what puzzled some 
> customers,
> telling me, that this strange path with slash and backslash can't work
> (though the reason was other)...

Do you have an example of error messages which are returned with such 
'mixed' paths in them?

> I know, that I could have refined the path platform specific only for
> messaging, but that was too much overhead for me. In future I will only 
> use
> slash and let the customers be puzzled.

Unfortunately, this is a general issue. Quite often the values you might 
need to use internally to actually run code will be different from those 
which users might expect. So some 'formatting for display' is always 
generally required in user-facing messages.

A similar situation to this is that of locale-specific number formatting 
(which, admittedly, LiveCode doesn't currently support).

In the UK, we use '.' as the decimal separator; in many European 
countries it is ','. It is easy to see why you need a fixed way to 
represent numbers when running them through script - i.e. using '.':
   put item 2 of "1.05,2.05,3.05"

If you used the user-formatted version of numbers you might end up with 
trying to do this:
   put item 2 of "1,05,2,05,3,05"

Which would, obviously, give you a completely different result! 
Filepaths are no different to this, and the same runs for dates, 
currencies, ...

Warmest Regards,

Mark.

-- 
Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps




More information about the use-livecode mailing list