@ Deprecated public static URI getParentPath ( PathCodec pathCodec , URI path ) { Preconditions . checkNotNull ( path ) ; // Root path has no parent. if ( path . equals ( GCS_ROOT ) ) { return null ; } StorageResourceId resourceId = pathCodec . validatePathAndGetId ( path , true ) ; if ( resourceId . isBucket ( ) ) { return GCS_ROOT ; } int index ; String objectName = resourceId . getObjectName ( ) ; if ( FileInfo . objectHasDirectoryPath ( objectName ) ) { index = objectName . lastIndexOf ( PATH_DELIMITER , objectName . length ( ) - 2 ) ; } else { index = objectName . lastIndexOf ( PATH_DELIMITER ) ; } return index < 0 ? pathCodec . getPath ( resourceId . getBucketName ( ) , null , true ) : pathCodec . getPath ( resourceId . getBucketName ( ) , objectName . substring ( 0 , index + 1 ) , false ) ; }
Gets the parent directory of the given path .