Fan.Sys.Uri.merge C# (CSharp) Method

merge() static private method

static private merge ( Sections t, Uri baseUri, Uri r ) : void
t Sections
baseUri Uri
r Uri
return void
        static void merge(Sections t, Uri baseUri, Uri r)
        {
            bool baseIsAbs = baseUri.isPathAbs();
              bool baseIsDir = baseUri.isDir();
              bool rIsDir    = r.isDir();
              List rPath     = r.m_path;
              bool dotLast   = false;

              // compute the target path taking into account whether
              // the base is a dir and any dot segments in relative ref
              List tPath;
              if (baseUri.m_path.sz() == 0)
              {
            tPath = r.m_path;
              }
              else
              {
            tPath = baseUri.m_path.rw();
            if (!baseIsDir) tPath.pop();
            for (int i=0; i<rPath.sz(); ++i)
            {
              string rSeg = (string)rPath.get(i);
              if (rSeg == ".") { dotLast = true; continue; }
              if (rSeg == "..")
              {
            if (!tPath.isEmpty()) { tPath.pop(); dotLast = true; continue; }
            if (baseIsAbs) continue;
              }
              tPath.add(rSeg); dotLast = false;
            }
            //tPath = tPath;
              }

              t.path = tPath;
              t.pathStr = toPathStr(baseIsAbs, tPath, rIsDir || dotLast);
        }