13046 How to make basefilepaths relative?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • chrisjj
    Carpal Tunnel
    • Apr 2008
    • 2537

    13046 How to make basefilepaths relative?

    How can I make left/right basepaths relative to the BC installation path?

    Or otherwise solve the failure of in-project portable installation sessions to find their target basepaths when the project tree is relocated to a different base path e.g. drive letter?

    Thanks.
  • Aaron
    Team Scooter
    • Oct 2007
    • 15997

    #2
    Hello,

    Our sessions store session settings only as absolute paths. We don't currently support relative paths from the main BCompare.exe location.

    You can manually Find/Replace All the path variables in our BCSessions.xml if you move the portable install, or fix sessions as you load them.
    Aaron P Scooter Software

    Comment

    • Zoë
      Team Scooter
      • Oct 2007
      • 2666

      #3
      If you use relative paths (like ".\foo") it will be relative to the "current directory" when BC is launched. You can also use environmental variables by including them in the form %variable_name%.

      The easiest way would be to use either of those approaches and launch BC from a batch file. You can use this post to get the path of the batch file, and then either 'CD' into it or set a variable before launching BC.
      Zoë P Scooter Software

      Comment

      • Lutz
        Veteran
        • Oct 2007
        • 356

        #4
        I gave it a try and I think relative paths are useful for this purpose. EDIT: An absolute path starting at the root folder may be more useful.

        I moved a portable install between my two backup drives after loading a relative path.
        The display shows the real paths (B:\..., then E:\...), while editing the relative path shows up again (same before and after moving).

        Storing BC portable on the first folder level (anydrive:\BC) makes navigating as easy as loading drive letters by replacing "anydrive:\" by ".." (parent folder).
        EDIT: It is sufficient to start a base folder with "\" (with auto-completion) to make it independent from drive letter (omit relative navigating up with ".." without auto-completion). The folder of BC3 can be anywhere on the same storage.

        One small issue: Normally I use a non-portable (how would you call this in english?) installation with administrative rights. The current directory "." here is C:\Windows\System32 and not the BC installation path.

        Greetings Lutz

        EDIT PS:
        The answer to Chris' initial question should be simply omitting the drive letter if there is only one portable install on removable storage.
        Last edited by Lutz; 25-Jan-2011, 03:21 AM.

        Comment

        • chrisjj
          Carpal Tunnel
          • Apr 2008
          • 2537

          #5
          Team Scooter wrote

          > Our sessions store session settings only as absolute paths.
          > We don't currently support relative paths

          and

          > If you use relative paths (like ".\foo") it will be relative to the
          > "current directory" when BC is launched.

          Which is it??

          Comment

          • Zoë
            Team Scooter
            • Oct 2007
            • 2666

            #6
            Originally posted by chrisjj
            Which is it??
            Well, I'm the one who wrote the path handling code, so I'm guessing it's what I said. :P
            Zoë P Scooter Software

            Comment

            • chrisjj
              Carpal Tunnel
              • Apr 2008
              • 2537

              #7
              OK, thanks, then I take it you have no suggestion for:

              "How can I make left/right basepaths relative to the BC installation path?"

              and it is for

              "Or otherwise solve the failure of in-project portable installation sessions to find their target basepaths when the project tree is relocated to a different base path e.g. drive letter?"

              that you suggest

              > If you use relative paths (like ".\foo") it will be relative to the
              > "current directory" when BC is launched.

              In Windows Explorer I select two text files, right-click, click Compare, and get a good view. Then I edit one basefilepath from C:\temp\file1.txt to .\file1.txt as per your suggestion.

              I get "Error opening file", the error being (I guess, in the absence of anything identifying it) "File not found".

              presumably BC is not setting the "current directory" to the directory from which it was launched. Despite that File Save As... shows that directory (I guess BC must be specifically overriding the current directory for this operation).

              How can I determine what BC thinks the current directory is?

              Comment

              • Lutz
                Veteran
                • Oct 2007
                • 356

                #8
                Originally posted by chrisjj
                ...
                How can I determine what BC thinks the current directory is?
                Open an empty Folder Compare session and just enter the current dot-path (".") on one side. BC will show the path by leaving the path edit listbox.

                Tested with custom and portable installation.

                Greetings Lutz

                Comment

                • Zoë
                  Team Scooter
                  • Oct 2007
                  • 2666

                  #9
                  Originally posted by chrisjj
                  OK, thanks, then I take it you have no suggestion for:

                  "How can I make left/right basepaths relative to the BC installation path?"
                  That's correct. We've already created a feature request entry to make it easier for you to have multiple portable installs. Nothing has changed since the last time you asked about it.

                  Originally posted by chrisjj
                  presumably BC is not setting the "current directory" to the directory from which it was launched.
                  In this case BC was "launched" from the Explorer context menu, which means it's dependent on Explorer's current directory, and apparently Explorer doesn't change it when you navigate around. The fact that BC doesn't change the current directory further is intentional.

                  That's why my workaround was dependent on launching BC through a batch file so you have a known good location. I'm not clear on your exact setup, but the Explorer menu extensions aren't supported from portable installs.
                  Zoë P Scooter Software

                  Comment

                  • Lutz
                    Veteran
                    • Oct 2007
                    • 356

                    #10
                    How do I get other current directory than installation directory (either fixed or portable) or ...\system32 (launched as administrator)?
                    I got one by launching from batch file, but here I intended just this directory and can also set up comparitions with relative paths.

                    I also tried launching from context menu with no difference.

                    As I posted on 25th changed drive letters should not be a problem.

                    Greetings Lutz

                    Comment

                    • chrisjj
                      Carpal Tunnel
                      • Apr 2008
                      • 2537

                      #11
                      > That's correct. We've already created a feature request entry to make it
                      > easier for you to have multiple portable installs. Nothing has changed
                      > since the last time you asked about it.

                      I have not previously asked about relative base pathnames.

                      > That's why my workaround was dependent on launching BC through a batch
                      > file so you have a known good location.

                      Does BC itself not give the user some way of setting the current directory that it's dependent on?

                      > the Explorer menu extensions aren't supported from portable installs.

                      Ah, figures - thanks for the forewarning.

                      Comment

                      • chrisjj
                        Carpal Tunnel
                        • Apr 2008
                        • 2537

                        #12
                        > Open an empty Folder Compare session and just enter the current dot-path
                        > (".") on one side. BC will show the path by leaving the path edit listbox.

                        Thanks. On a non-portable installation launched by Explorer Compare, I get

                        C:\Program Files\Common Files\System\Mapi\1033\NT

                        Not very useful

                        Comment

                        • Lutz
                          Veteran
                          • Oct 2007
                          • 356

                          #13
                          Originally posted by chrisjj
                          ... solve the failure of in-project portable installation sessions to find their target basepaths when the project tree is relocated to a different base path e.g. drive letter?
                          Originally posted by chrisjj
                          ...
                          I have not previously asked about relative base pathnames.
                          ...
                          If so, why doesn't help starting base paths just with "\" instead of drive letter?

                          I think I guessed it now:
                          On one drive you have several projects with same folder structure and each has its own portable BC installation in its structure. To share stored BC sessions between you need base paths relative to the BC installation directory.

                          If I'm right you should have told in your initial post to share your use case with other users and get more useful help.

                          If I'm not right please explain your use case (espacially project and used BC installation location).

                          Greetings Lutz

                          Comment

                          • chrisjj
                            Carpal Tunnel
                            • Apr 2008
                            • 2537

                            #14
                            > On one drive you have several projects with same folder structure
                            > and each has its own portable BC installation in its structure.

                            Yes.

                            > To share stored BC sessions between you need base paths relative
                            > to the BC installation directory.

                            No. The reason I need relative base paths is as I said in the initial post: to

                            "solve the failure of in-project portable installation sessions to find their target basepaths when the project tree is relocated to a different base path"

                            > If I'm right you should have told in your initial post to share your use case
                            > with other users and get more useful help.

                            I thought I explained my use case with "solve the failure of in-project portable installation sessions to find their target basepaths when the project tree is relocated to a different base path".
                            Last edited by chrisjj; 31-Jan-2011, 07:49 PM.

                            Comment

                            • Lutz
                              Veteran
                              • Oct 2007
                              • 356

                              #15
                              I don't understand (perhaps of my bad english), why relative base paths don't work for you.

                              Any Drive
                              +- BC
                              +- Data (including folder1 and folder2)

                              Launching BC directly from explorer sets current directory to Drive/BC.
                              Comparing folder1 and folder2 with "..\Data\folder1" and "..\Data\folder2" should work, even after moving BC & Data to another drives subfolder (without changing the relation between BC and Data of course).

                              Greetings Lutz

                              Comment

                              Working...