private Path getIndexPath( ArchivaIndexingContext ctx ) { return PathUtil.getPathFromUri( ctx.getPath( ) ); }
/** * Given a basedir and a child file, return the relative path to the child. * * @param basedir the basedir. * @param file the file to get the relative path for. * @return the relative path to the child. (NOTE: this path will NOT start with a {@link File#separator} character) */ public static String getRelative( String basedir, File file ) { return getRelative( basedir, file.getAbsolutePath() ); }
public static String toUrl( String path ) { // Is our work already done for us? if ( path.startsWith( "file:/" ) ) { return path; } return toUrl( Paths.get( path ) ); }
@Override public void setLocation( URI location ) { super.setLocation( location ); Path newLoc = PathUtil.getPathFromUri( location ); if (!Files.exists( newLoc )) { try { Files.createDirectories( newLoc ); } catch ( IOException e ) { log.error("Could not create directory {}",location, e); } } }
/** * Given a basedir and a child file, return the relative path to the child. * * @param basedir the basedir. * @param child the child path (can be a full path) * @return the relative path to the child. (NOTE: this path will NOT start with a file separator character) */ public static String getRelative( String basedir, String child ) { return getRelative(basedir, Paths.get(child)); }
public static String toUrl( String path ) { // Is our work already done for us? if ( path.startsWith( "file:/" ) ) { return path; } return toUrl( new File( path ) ); }
@Override public Path toFile( ArchivaArtifact reference ) { return PathUtil.getPathFromUri( repository.getLocation()).resolve( toPath( reference ) ); }
public String getRelativePath() { return PathUtil.getRelative( this.baseDir.getAbsolutePath(), this ); }
String defaultRepositoryUrl = PathUtil.toUrl( repositoryDirectory );
@Override public Path toFile( ArtifactReference reference ) { return PathUtil.getPathFromUri( repository.getLocation()).resolve( toPath( reference ) ); }
public BaseFile( File repoDir, File pathFile ) { this( repoDir, PathUtil.getRelative( repoDir.getAbsolutePath(), pathFile ) ); }
String defaultRepositoryUrl = PathUtil.toUrl( repositoryDirectory );
@Override public Path getLocalPath() { Path localPath; if (StringUtils.isEmpty(getLocation().getScheme()) || "file".equals(getLocation().getScheme()) ) { localPath = PathUtil.getPathFromUri(getLocation()); if (localPath.isAbsolute()) { return localPath; } else { return repositoryBase.resolve(localPath); } } else { return repositoryBase.resolve(getId()); } }
public static String getRelative(String basedir, Path file) { return getRelative(Paths.get(basedir), file); }
Path repoBase = PathUtil.getPathFromUri(repository.getLocation()).toAbsolutePath(); Path repoDir = repoBase.resolve( path );
public BaseFile( File repoDir, File pathFile ) { this( repoDir, PathUtil.getRelative(repoDir.getAbsolutePath(), pathFile.toPath() ) ); }
private Path getIndexPath(Repository repo) throws IOException { IndexCreationFeature icf = repo.getFeature(IndexCreationFeature.class).get(); Path repoDir = repo.getLocalPath(); URI indexDir = icf.getIndexPath(); Path indexDirectory = null; if ( ! StringUtils.isEmpty(indexDir.toString( ) ) ) { indexDirectory = PathUtil.getPathFromUri( indexDir ); // not absolute so create it in repository directory if ( !indexDirectory.isAbsolute( ) ) { indexDirectory = repoDir.resolve( indexDirectory ); } } else { indexDirectory = repoDir.resolve( DEFAULT_INDEXER_DIR ); } if ( !Files.exists( indexDirectory ) ) { Files.createDirectories( indexDirectory ); } return indexDirectory; }
public String getRelativePath() { return PathUtil.getRelative( this.baseDir.getAbsolutePath(), this.toPath() ); }
private Path getPackedIndexPath(Repository repo) throws IOException { IndexCreationFeature icf = repo.getFeature(IndexCreationFeature.class).get(); Path repoDir = repo.getLocalPath(); URI indexDir = icf.getPackedIndexPath(); Path indexDirectory = null; if ( ! StringUtils.isEmpty(indexDir.toString( ) ) ) { indexDirectory = PathUtil.getPathFromUri( indexDir ); // not absolute so create it in repository directory if ( !indexDirectory.isAbsolute( ) ) { indexDirectory = repoDir.resolve( indexDirectory ); } } else { indexDirectory = repoDir.resolve( DEFAULT_PACKED_INDEX_DIR ); } if ( !Files.exists( indexDirectory ) ) { Files.createDirectories( indexDirectory ); } return indexDirectory; }
PathUtil.getRelative( managedRepository.getRepoRoot(), path1 ) ).filter( filetypes::matchesArtifactPattern ).findFirst().orElse( null ); if (result!=null) {