Specifying file names

You should always pass in the full path name to the file you want to work with. For example, use

baOpenFile( "c:\data\myfile.pdf", "normal" ) or

baOpenFile( "Mac HD:Data:myfile.pdf", "normal" )

rather than

baOpenFile( "myFile.pdf", "normal" )

You should do this even when the file you are working with is in the same folder as your projector or application. If you want to work with a file that is relative to your projector or application, then you can use Lingo's the applicationPath or the moviePath variables; or Authorware's FileLocation variable. These variables return the path to the projector/application or the current .dir file. To open a file in the same folder as your projector, use:

baOpenFile( the applicationPath & "myFile.pdf", "normal" ) -- Director

baOpenFile( FileLocation ^ "myFile.pdf", "normal" ) -- Authorware

To open a file in a folder, add it to the path.

baOpenFile( the applicationPath & "data\\myFile.pdf", "normal" ) -- Director

baOpenFile( FileLocation ^ "data\myFile.pdf", :"normal" ) -- Authorware

In Director, you can also use Lingo's @ operator. This is the same as the moviePath, but can be used to specify cross-platform path names. Where a : / or \ character is included in your path name, it will be translated to the appropriate path separator.

baOpenFile( "@:Data:myFile.pdf", "normal" )

baOpenFile( "@/Data/myFile.pdf", "normal" )

baOpenFile( "@\Data\myFile.pdf", "normal" )

will all open the myfile.pdf in the Data subfolder on both platforms.

You must include a folder separator after the @.

 

On Macintosh, you can specify files using either Unix ( '/Volumes/Mac HD/data/myfile.pdf' ) or HFS ( 'Mac HD:Data:myfile.pdf' ) names. You can use baReturnUnixNames to specify whether Buddy functions return Unix or HFS names.