12 Replies Latest reply on Mar 3, 2009 6:11 PM by Newsgroup_User

    relative path

    wgb14 Level 1
      Hi all

      I am trying to access an ini file two levels up from my current movie location using this

      typeagent = baReadIni("Type_of_Agent","Agent","error","@\\\Main_Experiment\order.ini" )

      Main experiment is a folder and order.ini the file i am tryign to access using BuddAPI. But it fails to find the file and read any values. Any idea what I am doing wrong?
        • 1. Re: relative path
          Level 7
          > typeagent =
          > baReadIni("Type_of_Agent","Agent","error","@\\\Main_Experiment\order.ini" )
          >
          > Main experiment is a folder and order.ini the file i am tryign to access using
          > BuddAPI.

          Is the folder name "Main Experiment" or "Main_Experiment"? You have
          spelled it 2 different ways above.

          So you need to go up 2 levels and then down into a folder to find the
          file? Would it be simpler to base your path off _player.applicationPath?
          • 2. Re: relative path
            wgb14 Level 1
            The folder is Main_Experiment (with underscore).

            Would it be simpler to base your path off _player.applicationPath?

            What do you mean? Can you be more specific?
            • 3. Re: relative path
              James Newton, ACP Level 3
              Here's a sledgehammer to crack a nut. Go >here< and download the top three scripts. import them into your movie as Movie Scripts. Make sure the Xtra Broker script is called just that: "Xtra Broker".

              Now you can use...

              PathRelativeTo(aSourcePath, aReferencePath)

              ... and...

              PathMakeAbsolute(aPath, aList)

              To convert between absolute and relative paths, regardless of the platform on which the path was created.

              Does that help?
              • 4. Re: relative path
                fazstp Level 2
                I think the @ relative path only works with go to movie commands. For file handlers you generally need the full path.

                • 5. Re: relative path
                  Level 7
                  > Would it be simpler to base your path off _player.applicationPath?
                  >
                  > What do you mean? Can you be more specific?

                  Did you read the docs for 'the applicationPath'? Do you understand the
                  difference between _movie.path and _player.applicationPath?

                  Is the executable that runs you Director file further up the folder
                  hierarchy than the movie from which you are trying to locate you ini
                  file? If so, it might be easier to start an absolute path based on where
                  the executable is than where the movie is.
                  • 6. Re: relative path
                    wgb14 Level 1
                    OpenSpark I did what you recommended but I am uncertain how to use this:

                    PathRelativeTo(aSourcePath, aReferencePath)

                    what is the aSourcePath? the aReferencePath?, aPath? aList?

                    • 7. Re: relative path
                      wgb14 Level 1
                      Sean the folder that I want to access is on a different drive (D). Director resides on C:. I think the solution may come from the behaviours openspark suggested. However, i still need to figure out how to work with them. Openspark are you out tthere?
                      • 8. Re: relative path
                        wgb14 Level 1
                        I tried this in the message window

                        PathMakeAbsolute("@:::Main_Experiment")

                        and I am getting unable to create an instance of filextra. Any ideas?
                        • 9. Re: relative path
                          wgb14 Level 1
                          Got it. All I had to do was to download fileIOXtra 4.0. It works just fine. Many many thanks
                          • 10. Re: relative path
                            fazstp Level 2
                            Is the projector/ movie on C or D drive? If it's on C and the file is on D then I doubt a relative path is going to work.

                            The _player.applicationPath points to Director in authoring but it points to the exe when in a projector.

                            • 11. Re: relative path
                              Level 7
                              > Sean the folder that I want to access is on a different drive (D). Director
                              > resides on C:.

                              If it's on a different drive you *can't* construct a relative path! You
                              will have to provide the full path to your ini file.
                              • 12. Re: relative path
                                Level 7
                                > I tried this in the message window
                                >
                                > PathMakeAbsolute("@:::Main_Experiment")
                                >
                                > and I am getting unable to create an instance of filextra. Any ideas?

                                Yes, you neglected to provide your projector with a copy of FileXtra4.
                                But it's irrelevant - you cannot construct a relative path to a file on
                                a different drive.