Example usage for java.io File separatorChar

List of usage examples for java.io File separatorChar

Introduction

In this page you can find the example usage for java.io File separatorChar.

Prototype

char separatorChar

To view the source code for java.io File separatorChar.

Click Source Link

Document

The system-dependent default name-separator character.

Usage

From source file:gov.nih.nci.sdk.example.generator.util.GeneratorUtil.java

public static String getServiceClientPath(ScriptContext _scriptContext) {
    return getGeneratedPath(_scriptContext) + File.separator
            + EcoreUtil.determinePackageName(_scriptContext.getFocusDomain()).replace('.', File.separatorChar)
            + File.separator + Generator.SERVICE_PACKAGE_NAME + File.separator
            + Generator.SERVICE_CLIENT_PACKAGE_NAME;
}

From source file:org.red5.server.Bootstrap.java

/**
 * Gets the configuration root//from ww w .ja va 2s .c om
 * 
 * @param root
 * @return
 */
private static String getConfigurationRoot(String root) {
    // look for config dir
    String conf = System.getProperty("red5.config_root");

    // if root is not null and conf is null then default it
    if (root != null && conf == null) {
        conf = root + "/conf";
    }

    //flip slashes only if windows based os
    if (File.separatorChar != '/') {
        conf = conf.replaceAll("\\\\", "/");
    }

    //set conf sysprop
    System.setProperty("red5.config_root", conf);
    System.out.printf("Configuation root: %s\n", conf);
    return conf;
}

From source file:com.gnamp.struts.action.TerminalSettingAction.java

private static String AssignPath(long devId) {
    return CONFIG_ROOT + File.separatorChar + String.format("%016X.xml", new Object[] { Long.valueOf(devId) });
}

From source file:at.riemers.velocity2js.velocity.Velocity2Js.java

private static void process(File file, String dir, BufferedWriter out, ResourceBundle bundle) throws Exception {
    if (file.isDirectory()) {

        if (dir == null) {
            dir = "";
        } else {//w w  w . ja v a2s  . c  o  m
            int index = file.getPath().lastIndexOf(File.separatorChar);
            if (dir.equals("")) {
                dir = dir + file.getName();
            } else {
                dir = dir + "/" + file.getName();
            }
        }

        File[] files = file.listFiles();

        for (int i = 0; i < files.length; i++) {
            process(files[i], dir, out, bundle);
        }
    } else {
        if (file.getName().endsWith(".vm")) {
            processTemplate(dir + "/" + file.getName(), out, bundle);
        }
    }
}

From source file:com.sap.dirigible.ide.workspace.ui.commands.UploadDataHandler.java

private IStatus insertIntoDb(Collection<String> fileNames) {
    if (fileNames == null || fileNames.isEmpty()) {
        return new Status(IStatus.ERROR, PLUGIN_ID, NO_FILES_SPECIFIED);
    }/*from ww w  . j  a v a2s .  c om*/

    String fileName = null;
    MultiStatus multiStatus = new MultiStatus(PLUGIN_ID, IStatus.OK, UPLOAD_DATA_RESULT, null);
    for (String fullFileName : fileNames) {
        fileName = fullFileName.substring(fullFileName.lastIndexOf(File.separatorChar) + 1);
        InputStream in = null;
        try {
            in = new FileInputStream(fullFileName);
            byte[] data = IOUtils.toByteArray(in);
            DBTableDataInserter dataInserter = new DBTableDataInserter(
                    DataSourceFacade.getInstance().getDataSource(), data, fileName);
            dataInserter.insert();
            multiStatus.add(new Status(IStatus.OK, PLUGIN_ID, SUCCESSFULLY_IMPORTED_FILE + fileName));
        } catch (Exception e) {
            logger.error(CANNOT_STORE_DATA_FROM + fileName, e);
            String errMessage = CANNOT_STORE_DATA_FROM + fileName;
            multiStatus.add(new Status(IStatus.ERROR, PLUGIN_ID, errMessage, e));
        } finally {
            if (in != null) {
                try {
                    in.close();
                } catch (IOException e) {
                    logger.warn(CANNOT_CLOSE_INPUT_STREAM_TO_AN_UPLOADED_FILE, e);
                }
            }
        }
    }

    if (multiStatus.getChildren().length == 1) {
        return multiStatus.getChildren()[0];
    } else {
        return multiStatus;
    }
}

From source file:jenkins.plugins.shiningpanda.PythonInstallation.java

/**
 * Get the executable path for the provided executable name
 * /*from w  w  w.  ja v a 2s . co  m*/
 * @param execName
 *            The executable to find
 * @return Full path to executable if exists
 */
protected File getExeFile(String execName) {
    if (File.separatorChar == '\\')
        execName += ".exe";
    String pythonHome = Util.replaceMacro(getHome(), EnvVars.masterEnvVars);
    return new File(pythonHome, "bin/" + execName);
}

From source file:eionet.gdem.dcm.conf.DcmProperties.java

public void setSystemParams(Long qaTimeout, String cmdXGawk) throws DCMException {

    String filePath = Properties.appHome + File.separatorChar + "gdem.properties";

    try {/* w  ww.j  av a 2s. c om*/

        BufferedReader reader = new BufferedReader(new FileReader(filePath));
        String line = null;
        StringBuffer st = new StringBuffer();

        while ((line = reader.readLine()) != null) {
            // process the line
            line = findSetProp(line, "external.qa.timeout", String.valueOf(qaTimeout));
            line = findSetProp(line, "external.qa.command.xgawk", cmdXGawk);
            st.append(line);
            st.append("\n");
        }

        BufferedWriter out = new BufferedWriter(new FileWriter(filePath));
        out.write(st.toString());
        out.close();

        Properties.xgawkCommand = cmdXGawk;
        Properties.qaTimeout = Long.valueOf(qaTimeout);

    } catch (IOException e) {
        LOGGER.error("Saving system parameters failed!", e);
        e.printStackTrace();
        throw new DCMException(BusinessConstants.EXCEPTION_PARAM_SYSTEM_FAILED);
    }
}

From source file:es.jamisoft.comun.utils.compression.Jar.java

public void descomprimir(String lsDirDestino) {
    try {//from  w w w.  ja v a  2  s. com
        JarFile lzfFichero = new JarFile(isFicheroJar);
        Enumeration lenum = lzfFichero.entries();
        JarArchiveEntry entrada = null;
        InputStream linput;

        for (; lenum.hasMoreElements(); linput.close()) {
            entrada = (JarArchiveEntry) lenum.nextElement();
            linput = lzfFichero.getInputStream(entrada);

            byte labBytes[] = new byte[2048];
            int liLeido = -1;
            String lsRutaDestino = lsDirDestino + File.separator + entrada.getName();

            lsRutaDestino = lsRutaDestino.replace('\\', File.separatorChar);

            File lfRutaCompleta = new File(lsRutaDestino);
            String lsRuta = lfRutaCompleta.getAbsolutePath();
            int liPosSeparator = lsRuta.lastIndexOf(File.separatorChar);

            lsRuta = lsRuta.substring(0, liPosSeparator);

            File ldDir = new File(lsRuta);
            boolean lbCreado = ldDir.mkdirs();

            if (entrada.isDirectory()) {
                continue;
            }

            FileOutputStream loutput = new FileOutputStream(lfRutaCompleta);

            if (entrada.getSize() > 0L) {
                while ((liLeido = linput.read(labBytes, 0, 2048)) != -1) {
                    loutput.write(labBytes, 0, liLeido);
                }
            }

            loutput.flush();
            loutput.close();
        }

        lzfFichero.close();
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:eu.eidas.node.utils.PluginPropertyLoader.java

private void updatePropLocation() {
    if (locationProp != null && locationNames != null && locationNames.length > 0) {
        List<Resource> loadedLocations = new ArrayList<Resource>();
        DefaultResourceLoader drl = new DefaultResourceLoader();
        String locationPropValue = PropertiesUtil.getProperty(locationProp);
        for (int i = 0; i < locationNames.length && locationPropValue != null; i++) {
            String currentLocation = locationPropValue + locationNames[i];
            loadedLocations.add(drl.getResource("file:" + currentLocation.replace(File.separatorChar, '/')));
        }/*from   w w  w  . ja  v a2  s.c o m*/
        locations = new Resource[loadedLocations.size()];
        loadedLocations.toArray(locations);
        if (isLocationReadable(locationPropValue) && locations.length > 0) {
            setLocations(locations);
        }
    }
}

From source file:com.googlecode.jsfFlex.shared.tasks.sdk.UnzipTask.java

private void ensureDirectoryExists(String directoryToCheck, boolean isDirectory) {
    String[] directorySplitted = directoryToCheck.split("/");
    int lengthToTraverse = isDirectory ? directorySplitted.length : directorySplitted.length - 1;

    String tempLocation = _dest;/*from www. j  av a2 s . c o m*/
    for (int i = 0; i < lengthToTraverse; i++) {
        tempLocation += directorySplitted[i] + File.separatorChar;
        File currDirCheck = new File(tempLocation);
        if (!currDirCheck.exists()) {
            currDirCheck.mkdir();
        }
    }

}