specialFolderPath("resources") on Mac with trailing slash

Richard Gaskin ambassador at fourthworld.com
Wed Mar 29 08:41:20 EDT 2017


panagiotis wrote:
 > On Wed, Mar 29, 2017 at 9:43 AM, Tiemo Hollmann TB wrote:
 >
 >> LC 8.1.3: getting the specialFolderPath("resources") comes on Mac &
 >> Win without trailing slash.
 >>
 >> On Win I also don't get a trailing slash in a standalone.
 >>
 >> BUT in a MacOS 10.12 standalone I get a trailing slash!
 >>
 >> Is this a wanted "feature" which I have to script around, or is this
 >> a bug I should file?
 >
 > This is a bug, which will be fixed in LiveCode 8.1.4 RC-1:
 >
 > http://quality.livecode.com/show_bug.cgi?id=18619

This is also a good reminder about code style for those of us who write 
libraries:

The engine is pretty consistent about not including the trailing slash 
with values returned from functions that are folder paths.

Indeed where it does, as we've seen here, it's probably a bug.

If we all follow that convention it can reduce the learning curve for 
your APIs, and allow one to swap out one function for another with 
relative ease.

I used to write my own folder path functions that included the trailing 
slash.  Seemed like a good idea at the time, since it saved me from 
having to include the slash when concatenating with a file name later on.

But I found over time that I had to think about things too much, to keep 
track of which functions included the slash and which didn't, so I could 
concatenate correctly, avoiding double slashes.

No more.  Now I follow the engine convention of not including the 
trailing slash, and life is that much simpler. :)

-- 
  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