Problems With Linked Files

Date:    Thu, 20 Nov 1997 13:39:48 -0800
From:    Greg Yachuk 
Subject: Re: Problem with linked files in D5 (Urgent Help!)
I've written a few times about the gotcha's of using external files in a cross-platform production. Following are a couple of reposts, one from June 1997 and one from February 1997.

The first one gives a recipe for making sure that all your files can be found. The second one tries to explain how we locate files. This might give you insight into any problems that you may be having.

The most common problem that I've seen is that a .dir file has been saved somewhere (like to the Desktop) and then moved to the intended folder. While this seems like a good idea (so you don't clobber your original file) it plays havoc with the code in Director that resolves pathnames at runtime.

*** N O T E ***

The original question was specifically about pathnames in Director 5. There is a bug in D5 (which has been fixed in D6) that caused the "Where is ...?" dialog to come up with a pathname that has both colons and backslashes intermingled. If you have this problem, make sure you preload your castmember before you "set the filename of member ...". You can also look in the various archives for an explanation of what is going on.

BTW, I searched the Direct-L archives from the director-online search page, looking for the keywords "greggy" and "path". I got around 39 hits and in there should be the answer to just about any question you have about pathnames in Director. Good luck.


REPOST
Director tries to figure out the current location of files based on where files were most recently saved to.

There are a number of things that can go wrong.

For example, if you have your .dir files on one drive and all your content on another, everything will continue to work on your development systems, but you will be unable to locate content when run on other systems.

Another thing that can go wrong is to save your .dir or .cst files to some location and then use the Finder/Explorer to move them to the different folders. Director records the location that the file was last saved to and uses that to try to construct relative paths.

Here is a recipe for making things go smoothly.

  1. Create your directory structure all on one disk.

  2. Move (don't copy) your .dir, .cst and content files to their proper location on that disk. (The goal here is to make sure that you don't reference the originals on other disks. These will be found on your system, even when running from a CD, but won't be found on others' disks.)

    If you really want to copy the files, rather than moving them, you have several alternatives. As I said above, the goal is to make sure that Director can only find the files that you want found, not other copies. You can disconnect the disks with the copies or you could do all this on an external drive which you can move to a system which doesn't have any other copies of files.

  3. Update Movies (in the Xtras menu).

    1. Check the "Add All" Includes Folders checkbox.
    2. Navigate to the root folder of your stuff.
    3. Hit the Add All button to all all your .dir and .cst files.
    4. OK
If you are asked to resolve any files, make sure that you do not Cancel the dialog.

Once this has been done, your disk should contain an image that is ready for burning to CD. It should work on any drive on both Mac and Windows systems.

There is one "gotcha" in Director 4 and 5, whereby you are prompted for a pathname and the one that is displayed has a mixtures of colons and backslashes, but it doesn't sound like you are having this problem. If you do, make sure that you preload the cast member before setting the filename.


REPOST
The filenames of all linked media are displayed as absolute pathnames in the cast member info dialogs, and when you "put the filename of member..."

However, when you open a movie in Director or load a cast member in a projector, we try to resolve all references to files. We always store the full path to where the Director movie (or cast if external casts are used) and the full path to each linked cast member. Basically, we do the following:

  1. Figure out where the saved cast member file is relative to the saved Director movie (or cast).

  2. Figure out where the actual movie or cast really is on disk.

  3. Apply the relative path figured out in step 1 to the the actual location, and look for the linked file there. (This allows you to rename your hard disk, move your entire production to a different folder, to a different hard disk, or to a different OS.)

  4. If the file isn't there, try the absolute path to the linked file. This is obviously OS dependent. This step pretty is much guaranteed to fail when the movie is transported from Mac to Windows or vice versa. It's done to help simplify any reorganizations done on your project's file structure during development.
These exact same steps are used for resolving Director movies (for goto or play) and for resolving linked media.

So the short answer to your question is "you don't need relative paths for linked files, you really need absolute paths which is what you have."

Also, Doug Smith responded that he was having problems using the "@" notation. The most common problem is caused by changing the "relative paths" between movies or between a movie/cast and linked files. For instance, many people keep their movies and linked files in separate folders. This is normally fine and Director keeps track of the links.

However, if you are working on a movie and do a "Save As..." to the desktop or some other temporary location and then manually move the file back into the original folder, you will have problems when transferring the production to another OS.

The best thing to do when transferring a production over to another OS is to Update Movies before transferring. Also, if you are asked to locate files during Update Movies, make sure you actually locate them. If you cancel, the original links are retained which will cause the lookup to continue to fail. A bit of clarification: Cancelling out doesn't hurt your movie in any way. It's just that if you cancel out of looking up files, you can expect to have to look it up anyways when you get to the other system. At that point, you have to make sure that you catch all possible references. It is simply much easier, much more complete and all-around much better karma to do this in Update Movies.

Greg Yachuk
Macromedia Director Engineer

"What's so Great about the Barrier Reef? And what's so Fine about Art?"