Return the parent Path.
Treat a URI like a directory path and return the parent directory.

@param p the path to return a parent reference to
@return the parent path of the URI
192543
public static String parentPath(String p) {
        if (p == null || URIUtils.SLASH.equals(p))
            return null;
        int slash = p.lastIndexOf('/', p.length() - 2);
        if (slash >= 0)
            return p.substring(0, slash + 1);
        return null;
    }
931264
public static String getParentPath(final String path) {
    final int pos = path.lastIndexOf(File.separator);
    if (pos <= 0) {
      return null;
    }
    return path.substring(0, pos);
  }
832024
def get_path():
    
    # Theme directory is defined as our parent directory
    return os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
890698
public static String getParentDirPath(final String path, final char separator) {
        final int lastSlashIdx = path.lastIndexOf(separator);
        if (lastSlashIdx <= 0) {
            return "";
        }
        return path.substring(0, lastSlashIdx);
    }
255884
public ResourceName parentName() {
    PathTemplate parentTemplate = template.parentTemplate();
    return new ResourceName(parentTemplate, values, endpoint);
  }
881156
@Nullable
  public static Location getParent(Location location) {
    URI source = location.toURI();

    // If it is root, return null
    if ("/".equals(source.getPath())) {
      return null;
    }

    URI resolvedParent = URI.create(source.toString() + "/..").normalize();
    return location.getLocationFactory().create(resolvedParent);
  }
908916
private void buildParentPath() {

        String destFolder = m_destinationDir;
        String inputDir = m_inputDir.replace('\\', '/');
        if (!inputDir.endsWith("/")) {
            inputDir += "/";
        }
        int pos = inputDir.lastIndexOf("/");
        while ((pos > 0) && (destFolder != null)) {
            inputDir = inputDir.substring(0, pos);
            m_parents.put(inputDir + "/", destFolder);

            pos = inputDir.lastIndexOf("/", pos - 1);
            destFolder = CmsResource.getParentFolder(destFolder);
        }
    }
1322275
public CPath getCPath()
    {
        if ( parent == null ) {
            return CPath.ROOT;
        }

        CMFolder currentFolder = this;
        StringBuilder path = new StringBuilder(  );

        while ( currentFolder.parent != null ) {
            path.insert( 0, currentFolder.name );
            path.insert( 0, '/' );

            currentFolder = currentFolder.parent;
        }

        return new CPath( path.toString() );
    }
1030996
def get_parent(self, level=1):
        '''
        
        '''
        try:
            parent_path = self.path.get_parent(level)
        except ValueError: # abspath cannot get parent
            return None
        assert parent_path
        return DirectoryInfo(parent_path)
72527
def parent(self):
        
        p = self._lib.dirname(self.path)
        p = self.__class__(p)
        return p
1022561
private String getParentFolder() {

        String relativeTo;
        if (isDirectPublish()) {
            relativeTo = CmsResource.getParentFolder(getResourceList().get(0));
        } else {
            relativeTo = getCms().getRequestContext().getSiteRoot() + "/";
        }
        return relativeTo;
    }
383032
@CheckForNull
    public String getPath() {
        Source parent = getParent();
        if (parent != null)
            return parent.getPath();
        return null;
    }
795922
public static File file(File parent, String path) {
		if (StrUtil.isBlank(path)) {
			throw new NullPointerException("File path is blank!");
		}
		return checkSlip(parent, new File(parent, path));
	}
968064
def GetParentFileEntry(self):
    
    location = getattr(self.path_spec, 'location', None)
    if location is None:
      return None

    parent_location = self._file_system.DirnamePath(location)
    if parent_location is None:
      return None

    if parent_location == '':
      parent_location = self._file_system.PATH_SEPARATOR

    path_spec = fake_path_spec.FakePathSpec(location=parent_location)
    return self._file_system.GetFileEntryByPathSpec(path_spec)
679934
function (p, cb) {
				var pth = p.replace(/\\\?/g, '\/'); // Glob must use / as path seperator even on windows
				glob(pth + '/**/*.*', function (er, files) {
					if (er) {
						return cb(er);
					}
					return cb(null, files.map(function (f) {
						return path.relative(p, f);
					}));
				});
			}
751865
public URL getResource(String p) throws MalformedURLException
  {
    String rPath = null;

   /*
     * The spec states the resource must start with a / so if one isn't there we
     * prepend one.
     */
    // Begin 263020
    if (p.charAt(0) != '/' && p.charAt(0) != '\\')
    {
      if (prependSlashToResource)
      {
        logger.logp(Level.WARNING, CLASS_NAME, "getResource", "resource.path.has.to.start.with.slash");
        rPath = "/" + p;
      }
      else
      {
        throw new MalformedURLException(nls.getString("resource.path.has.to.start.with.slash"));
      }
    }
    else
    {
      rPath = p;
    }
    // End 263020
    
    if (container != null) {
        //Can not call getEntry with / on the root container
        if (p.equals("/")) {
            Collection<URL> urls = container.getURLs();
            Iterator<URL> it = urls.iterator();
            if (it.hasNext()) {
                URL url = it.next();  //get the first url
                
                if (url.getProtocol().equals("file")) { 
                    File file = new File(url.getFile());
                    if (file.exists() && !file.isDirectory()){  //might be a file:/xxx.war
                        return new URL("jar", "", -1, url + "!/");  //return jar:file:/xxx.war!/
                    }
                } 

                return url;
            }
        } else {
            Entry entry = container.getEntry(rPath);
            if (entry != null) {
                return entry.getResource();
            } else {
                return getDocumentRootUtils(rPath).getURL(rPath,metaInfCache);
            }
        }
    }

    String uri = getRealPath(rPath);
    if (uri == null)
    {
      return null;
    }

    java.io.File checkFile = new java.io.File(uri);
    if (!checkFile.exists())
    {
      if (!WCCustomProperties.SKIP_META_INF_RESOURCES_PROCESSING)
      {
        if (useMetaInfCache)
        {
          if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE))
          {
            logger.logp(Level.FINE, CLASS_NAME, "getResource", "trying META-INF/resources cache");
          }
          synchronized (metaInfCache)
          {
            if (metaInfCache.containsKey(rPath))
            {
              URL cachedURL = metaInfCache.get(rPath);
              if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE))
              {
                logger.logp(Level.FINE, CLASS_NAME, "getResource", "got cached META-INF name->[{0}], URL->[{1}]", new Object[] { rPath, cachedURL });
              }
              return cachedURL;
            }
          }
        }
        // URL otherURL = getWebInfLibClassloader().getResource(metaInfPath);
        MetaInfResourcesFileUtils metaInfFileUtil = new MetaInfResourcesFileUtils(this);
        metaInfFileUtil.findInMetaInfResource(rPath);
        URL metaInfURL = metaInfFileUtil.getURL();
        if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE))
        {
          logger.logp(Level.FINE, CLASS_NAME, "getResource", "file did not exist, trying META-INF/resources");
          logger.logp(Level.FINE, CLASS_NAME, "getResource", "metaInfPath->/META-INF/resources" + rPath);
        }
        if (useMetaInfCache)
        {
          if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE))
          {
            logger.logp(Level.FINE, CLASS_NAME, "getResource", "adding to META-INF cache name->[{0}], URL->[{1}]", new Object[] { rPath, metaInfURL });
          }
          synchronized (metaInfCache)
          {
            metaInfCache.put(rPath, metaInfURL);
          }
        }
        return metaInfURL;

      }
      else
      {
        if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE))
        {
          logger.logp(Level.FINE, CLASS_NAME, "getResource", "skipping META-INF/resources processing");
        }
        return null;
      }
    }
    return checkFile.toURL();

  }
741394
protected String getParentPath( String path ) {
        int slash = path.lastIndexOf('/');
        if (slash != -1) {
            return path.substring(0, slash);
        }
        return null;
    }