org.codehaus.plexus.util.FileUtils.normalize()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(2.8k)|赞(0)|评价(0)|浏览(117)

本文整理了Java中org.codehaus.plexus.util.FileUtils.normalize()方法的一些代码示例,展示了FileUtils.normalize()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtils.normalize()方法的具体详情如下:
包路径:org.codehaus.plexus.util.FileUtils
类名称:FileUtils
方法名:normalize

FileUtils.normalize介绍

[英]Normalize a path. Eliminates "/../" and "/./" in a string. Returns null if the ..'s went past the root. Eg:

/foo//               -->     /foo/ 
/foo/./              -->     /foo/ 
/foo/../bar          -->     /bar 
/foo/../bar/         -->     /bar/ 
/foo/../bar/../baz   -->     /baz 
//foo//./bar         -->     /foo/bar 
/../                 -->     null

[中]规范化路径。消除字符串中的“/../”和“/./”。如果..'它已经过了根。例如:

/foo//               -->     /foo/ 
/foo/./              -->     /foo/ 
/foo/../bar          -->     /bar 
/foo/../bar/         -->     /bar/ 
/foo/../bar/../baz   -->     /baz 
//foo//./bar         -->     /foo/bar 
/../                 -->     null

代码示例

代码示例来源:origin: apache/maven

public String findTool( String toolName )
{
  File toRet = findTool( toolName, new File( FileUtils.normalize( getJavaHome() ) ) );
  if ( toRet != null )
  {
    return toRet.getAbsolutePath();
  }
  return null;
}

代码示例来源:origin: apache/maven

+ JavaToolchainImpl.KEY_JAVAHOME + " configuration element." );
File normal = new File( FileUtils.normalize( javahome.getValue() ) );
if ( normal.exists() )
  jtc.setJavaHome( FileUtils.normalize( javahome.getValue() ) );

代码示例来源:origin: apache/maven-wagon

public TestSshFile( String fileName, File file, String userName )
  {
    super( FileUtils.normalize( fileName ), file, userName );
  }
}

代码示例来源:origin: org.apache.maven.wagon/wagon-ssh-common-test

public TestSshFile( String fileName, File file, String userName )
  {
    super( FileUtils.normalize( fileName ), file, userName );
  }
}

代码示例来源:origin: org.apache.maven.wagon/wagon-webdav

/**
 * Determine which URI to use at the prompt.
 *
 * @param uri the path to be set.
 * @return the absolute path.
 */
private String checkUri( String uri )
  throws IOException
{
  if ( webdavResource == null )
  {
    throw new IOException( "Not connected yet." );
  }
  if ( uri == null )
  {
    uri = webdavResource.getPath();
  }
  return FileUtils.normalize( uri );
}

代码示例来源:origin: mojohaus/exec-maven-plugin

throw new MisconfiguredToolchainException( "path element is empty" );
final String normalizedPath = FileUtils.normalize( pathString );
final File file = new File( normalizedPath );
if ( !file.exists() )

代码示例来源:origin: org.codehaus.mojo/exec-maven-plugin

throw new MisconfiguredToolchainException( "path element is empty" );
final String normalizedPath = FileUtils.normalize( pathString );
final File file = new File( normalizedPath );
if ( !file.exists() )

代码示例来源:origin: org.carewebframework/org.carewebframework.mvn.plugin.helpconverter

String sourceFilename = FileUtils.normalize(baseDirectory + "/" + moduleSource);
HelpProcessor processor = new HelpProcessor(this, sourceFilename, loader);
processor.transform();

代码示例来源:origin: apache/maven-wagon

String relpath = FileUtils.normalize( getPath( basedir, dir ) + "/" );

代码示例来源:origin: org.apache.maven.wagon/wagon-webdav-jackrabbit

String relpath = FileUtils.normalize( getPath( basedir, dir ) + "/" );

相关文章