List of usage examples for org.apache.commons.io FilenameUtils separatorsToUnix
public static String separatorsToUnix(String path)
From source file:org.opoo.press.maven.wagon.git.GitWagon.java
public void putDirectory(File sourceDirectory, String destinationDirectory) throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException { if (!sourceDirectory.isDirectory()) { throw new IllegalArgumentException("Source is not a directory: " + sourceDirectory); }//from w ww. j av a 2 s .c o m String resourceName = FilenameUtils.separatorsToUnix(destinationDirectory); Resource resource = new Resource(resourceName); firePutInitiated(resource, sourceDirectory); firePutStarted(resource, sourceDirectory); Repository repo = getRepository(); String url = repo.getUrl(); if (url.endsWith("/")) { url = url.substring(0, url.length() - 1); } String remote = url.substring(4); String branch = repo.getParameter("branch"); String message = repo.getParameter("message"); if (remote.startsWith("default://")) { remote = remote.substring(10); } if (branch == null) { branch = "master"; } try { Git git = new Git(checkoutDirectory, remote, branch); if (message != null) { git.setMessage(message); } if (safeCheckout) {//not cache, clone every time git.cloneAll(); } else { git.pullAll(); } FileUtils.copyDirectoryStructure(sourceDirectory, new File(checkoutDirectory, destinationDirectory)); git.pushAll(); } catch (Exception e) { fireTransferError(resource, e, TransferEvent.REQUEST_PUT); throw new TransferFailedException("Unable to put file", e); } firePutCompleted(resource, sourceDirectory); }
From source file:org.opoo.press.resource.Compass.java
Compass(File path, File configFile) { this.path = FilenameUtils.separatorsToUnix(path.getAbsolutePath()); this.config = FilenameUtils.separatorsToUnix(configFile.getAbsolutePath()); }
From source file:org.opoo.press.resource.CompassV2.java
CompassV2(File path, Map<String, Object> options) { this.path = FilenameUtils.separatorsToUnix(path.getAbsolutePath()); this.config = toCompassConfigRubyScript(options); }
From source file:org.opoo.press.source.SourceManagerImpl.java
@Override public SourceEntry buildEntry(File sourceDir, String path) { path = FilenameUtils.separatorsToUnix(path); String[] arr = StringUtils.split(path, "/"); SourceEntry entry = null;// w w w . ja v a2 s .c o m for (String s : arr) { sourceDir = new File(sourceDir, s); entry = new SourceEntry(entry, sourceDir); } return entry; }
From source file:org.opoo.util.PathUtils.java
public static File appendBaseIfNotAbsolute(File basedir, String name) { File file = null;/*w w w . j a v a2s. com*/ //maybe absolute path if (FilenameUtils.separatorsToUnix(name).indexOf('/') != -1) { File tmp = new File(name); if (tmp.isAbsolute()) { file = tmp; } } if (file == null) { file = new File(basedir, name); } return PathUtils.canonical(file); }
From source file:org.pentaho.cdf.localization.MessageBundlesHelper.java
public String getMessageFilesCacheUrl() { return FilenameUtils.separatorsToUnix(languagesCacheUrl); }
From source file:org.pentaho.cdf.render.HtmlDashboardRenderer.java
public static IBasicFile getDashboardTemplate(String solution, String path, String templateName) { templateName = FilenameUtils.separatorsToUnix(templateName); String fullTemplatePath = null; if (!StringUtils.isEmpty(templateName)) { if (templateName.startsWith("/")) { //$NON-NLS-1$ fullTemplatePath = templateName; } else {/*w w w . j a va2s . c om*/ fullTemplatePath = Util.joinPath(solution, path, templateName); } } return getDashboardTemplate(fullTemplatePath); }
From source file:org.pentaho.cdf.render.HtmlDashboardRenderer.java
public static IBasicFile getDashboardTemplate(String templatePath) { templatePath = FilenameUtils.separatorsToUnix(templatePath); IUserContentAccess repoAccess = CdfEngine.getUserContentReader(null); IReadAccess systemAccess = CdfEngine.getPluginSystemReader(null); IBasicFile dashboardTemplateFile = null; if (!StringUtils.isEmpty(templatePath) && repoAccess.fileExists(templatePath)) { // Check for access permissions if (repoAccess.hasAccess(templatePath, FileAccess.EXECUTE)) { dashboardTemplateFile = repoAccess.fetchFile(templatePath); } else {//from www . j av a2 s .c om logger.error("Access Denied to " + templatePath); } } else { dashboardTemplateFile = systemAccess.fetchFile(CdfConstants.DEFAULT_DASHBOARD_TEMPLATE_HTML); } return dashboardTemplateFile; }
From source file:org.pentaho.cdf.render.XcdfRenderer.java
/** * Determines the template based on the info stored in the xcdf file * * @param solution the dashboard file descriptor solution path part * @param path the dashboard file descriptor path part * @param action the dashboard file descriptor name * @param defaultTemplate the default template to use in case the defined is not available no if no template is * provided//from ww w.j a v a2s. c o m * @return boolean with the success of the operation * @throws InvalidCdfOperationException */ public boolean determineDashboardTemplating(final String solution, final String path, final String action, String defaultTemplate) throws InvalidCdfOperationException { return determineDashboardTemplating(FilenameUtils.separatorsToUnix(Util.joinPath(solution, path, action)), defaultTemplate); }
From source file:org.pentaho.cdf.render.XcdfRenderer.java
/** * Determines if a dashboard is to be rendered using require or using legacy javascript structure * * @param solution the dashboard file descriptor solution path part * @param path the dashboard file descriptor path part * @param action the dashboard file descriptor name * @return boolean with the success of the operation * @throws InvalidCdfOperationException//from w w w. j av a 2s . com */ public boolean determineRequireDashboard(final String solution, final String path, final String action) throws InvalidCdfOperationException { return determineRequireDashboard(FilenameUtils.separatorsToUnix(Util.joinPath(solution, path, action))); }