Example usage for org.apache.commons.io IOUtils DIR_SEPARATOR_UNIX

List of usage examples for org.apache.commons.io IOUtils DIR_SEPARATOR_UNIX

Introduction

In this page you can find the example usage for org.apache.commons.io IOUtils DIR_SEPARATOR_UNIX.

Prototype

char DIR_SEPARATOR_UNIX

To view the source code for org.apache.commons.io IOUtils DIR_SEPARATOR_UNIX.

Click Source Link

Document

The Unix directory separator character.

Usage

From source file:org.silverpeas.file.ModifText.java

/**
 * lance la modification du fichier Attention la modification s'effectue par ligne du fichier
 *//*  w  w  w.j  a v  a2  s .  co m*/
@Override
public void executeModification() throws Exception {
    File inFile = new File(path);
    List<String> lines = FileUtils.readLines(inFile);
    List<String> newLines = new ArrayList<String>(lines.size());
    for (String line : lines) {
        newLines.add(analyseLigne(line));
    }
    FileUtils.writeLines(inFile, newLines);
    // Specifique Linux/Solaris: on met le fichier de script en executable
    if ((path.endsWith(".sh") || path.endsWith(".csh") || path.endsWith(".ksh"))
            && IOUtils.DIR_SEPARATOR_UNIX == File.separatorChar) {
        String[] commande = new String[3];
        commande[0] = "/bin/chmod";
        commande[1] = "755";
        commande[2] = path;
        Runtime.getRuntime().exec(commande);
    }
}