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. If you use Unix names then you can use Unicode and long file names. If you use HFS, file names are restricted to 31 characters and can not contain Unicode characters. Buddy functions can accept names in either format, but the names will stay in the format passed. This means that if you pass in a HFS name, then resulting operations will be done using HFS names. For example, if you pass in a HFS source folder to baXCopy, then all files will be be copied in HFS format, so any long file names or names with Unicode characters will be given different names during the copy process. You can use baReturnUnixNames to specify whether Buddy functions return Unix or HFS names.