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:com.rogue.simpleclient.SimpleClient.java

/**
 * Constructs and authenticates a new client instance. Will ask for input
 * from a supplied {@link Scanner} source.
 *
 * @since 1.0.0/*from   w  w w  .j  a va2s  . c  o  m*/
 * @version 1.0.0
 *
 * @param input The {@link Scanner} to read input from
 * @throws IOException Any type of communications failure with Mojang
 */
public SimpleClient(Scanner input) throws IOException {
    System.out.print("What version are you launching (e.g. '1.7.9')?: ");
    this.version = input.nextLine();
    System.out.print("What is the full path for your application data folder containing minecraft?: ");
    this.appData = new File(input.nextLine());
    this.minecraftDir = new File(this.appData.getAbsoluteFile(), ".minecraft" + File.separatorChar);
    this.gameDir = new File(minecraftDir, "versions" + File.separator + this.version + File.separatorChar);
    this.natives = new File(gameDir, "natives" + File.separatorChar);
    System.out.print("Username: ");
    String username = input.nextLine();
    System.out.print("Password: ");
    this.connect(username, input.nextLine());
}

From source file:com.hazelcast.qasonar.codecoverage.CodeCoverageAnalyzer.java

private String getLocalGitRoot(PropertyReader props, GHRepository repo) {
    if (props.getLocalGitRoot() == null || props.getLocalGitRoot().isEmpty()) {
        return null;
    }/*ww w.j av  a 2 s .  c o m*/
    Repository repository = fromRepositoryName(repo.getName());
    File localGitRoot = new File(props.getLocalGitRoot() + repository.getRepositoryName()).getAbsoluteFile();
    if (!localGitRoot.isDirectory()) {
        debugRed("Could not find local Git repository at: " + localGitRoot.getAbsolutePath());
        return null;
    }
    debug("Using local Git repository at: " + localGitRoot);
    return localGitRoot.getAbsolutePath() + File.separatorChar;
}

From source file:com.util.FileService.java

/**
 * Get case file location/*from   w ww.  j  a v a  2s  .co m*/
 * 
 * @param item ActivityModel
 * @return String file path
 */
public static String getCaseFolderFileLocation(ActivityModel item) {
    return Global.getActivityPath() + File.separatorChar + NumberFormatService.getSection(item.getCaseType())
            + File.separatorChar + item.getCaseYear() + File.separatorChar
            + NumberFormatService.FullCaseNumber(item) + File.separatorChar + item.getFileName();
}

From source file:de.ailis.wlandsuite.PackPics.java

/**
 * @see de.ailis.wlandsuite.cli.PackProg#pack(java.io.File,
 *      java.io.OutputStream)//www  .j a v  a 2  s. c o  m
 */

@Override
public void pack(File directory, OutputStream output) throws IOException {
    List<PicsAnimation> animations;
    List<PicsAnimationFrameSet> frameSet;
    List<PicsAnimationInstruction> instructions;
    List<Pic> frames;
    Pic baseFrame, frame;
    String line;
    String[] parts;
    int delay;
    int picNo, frameSetNo, frameNo;
    BufferedReader reader;
    File file;
    File picDirectory, setDirectory;
    Pics pics;
    int lineNo;

    picNo = 0;
    animations = new ArrayList<PicsAnimation>();
    while (true) {
        picDirectory = new File(
                String.format("%s%c%03d", new Object[] { directory.getPath(), File.separatorChar, picNo }));
        if (!picDirectory.exists()) {
            break;
        }

        log.info("Reading pic " + picNo);

        // Read the base frame
        baseFrame = new Pic(ImageIO.read(new File(picDirectory.getPath() + File.separatorChar + "000.png")));

        // Read the frame sets
        frameSetNo = 0;
        frameSet = new ArrayList<PicsAnimationFrameSet>();
        while (true) {
            setDirectory = new File(String.format("%s%c%03d",
                    new Object[] { picDirectory.getPath(), File.separatorChar, frameSetNo }));
            if (!setDirectory.exists()) {
                break;
            }

            // Read the instructions
            instructions = new ArrayList<PicsAnimationInstruction>();
            file = new File(setDirectory.getPath() + File.separatorChar + "animation.txt");
            if (!file.exists()) {
                log.error("Animation file '" + file.getPath() + "' not found");
            }
            reader = new BufferedReader(new FileReader(file));
            lineNo = 0;
            while ((line = reader.readLine()) != null) {
                lineNo++;
                line = line.split("#")[0].trim();
                if (line.length() == 0)
                    continue;
                parts = line.split("[ \\t]+");
                try {
                    delay = Integer.parseInt(parts[0]);
                    frameNo = Integer.parseInt(parts[1]);
                    instructions.add(new PicsAnimationInstruction(delay, frameNo));
                } catch (Exception e) {
                    log.error("Syntax error in animation file '" + file.getPath() + "' line " + lineNo);
                }
            }

            // Read the frames
            frameNo = 0;
            frames = new ArrayList<Pic>();
            while (true) {
                file = new File(String.format("%s%c%03d.png",
                        new Object[] { setDirectory.getPath(), File.separatorChar, frameNo + 1 }));
                if (!file.exists()) {
                    break;
                }
                frame = new Pic(ImageIO.read(file));
                frames.add(frame);

                frameNo++;
            }
            frameSet.add(new PicsAnimationFrameSet(frames, instructions));
            frameSetNo++;
        }
        animations.add(new PicsAnimation(baseFrame, frameSet));

        picNo++;
    }

    pics = new Pics(animations);
    if (this.disk == -1) {
        pics.write(output);
    } else {
        pics.write(output, this.disk);
    }
}

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

public static String getServiceImplPath(ScriptContext _scriptContext) {
    String serviceImplPath = getImplPath(_scriptContext) + File.separator
            + EcoreUtil.determinePackageName(_scriptContext.getFocusDomain()).replace('.', File.separatorChar)
            + File.separator + Generator.SERVICE_PACKAGE_NAME;

    return serviceImplPath;
}

From source file:net.larry1123.elec.util.logger.EELogger.java

public EELogger(EELogger parent, String name, boolean fileLog) {
    this.parent = parent;
    logger = LoggerFactory.getLogger((hasParent() ? getParent().getName() + "." : "") + name);
    fileLogger = new FileLogger(getName());
    path = hasParent() ? parent.getPath() : getConfig().getLoggerPath() + getName() + File.separatorChar;
    logFile = getPath() + (hasParent() ? getName().substring(getName().indexOf(".") + 1) : "latest");
    boolean fileLoggingTemp = fileLog;
    FileManager.trackLogger(this);
    if (fileLoggingTemp) {
        try {/*from  ww w . ja  v a2 s.co m*/
            FileManager.fileLog(this);
            fileLoggingTemp = true;
        } catch (IOException e) {
            error("Unable to setup file logging!", e);
            fileLoggingTemp = false;
        }
    }
    setFileLogging(fileLoggingTemp);
    if (hasParent()) {
        getFileLogger().setParent(getParent().getFileLogger());
    }
}

From source file:de.fabianonline.telegram_backup.mediafilemanager.StickerFileManager.java

public String getTargetPath() {
    String path = user.getFileBase() + Config.FILE_FILES_BASE + File.separatorChar + Config.FILE_STICKER_BASE
            + File.separatorChar;
    new File(path).mkdirs();
    return path;/* w w w.j a  va2s.  com*/
}

From source file:org.dspace.app.webui.cris.controller.FormSendMailController.java

protected ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object command,
        BindException errors) throws Exception {

    MailDTO dto = (MailDTO) command;/*w  ww. j a va 2 s  .  c  o  m*/

    // send mail
    Email email = Email.getEmail(ConfigurationManager.getProperty("dspace.dir") + File.separatorChar + "config"
            + File.separatorChar + "emails" + File.separatorChar + dto.getTemplate());
    email.addArgument(dto.getRp());
    email.addArgument(dto.getText());
    email.addRecipient(ConfigurationManager.getProperty("feedback.recipient"));
    email.setReplyTo(UIUtil.obtainContext(request).getCurrentUser().getEmail());
    email.send();
    return new ModelAndView(getSuccessView() + dto.getRp());
}

From source file:net.sourceforge.floggy.persistence.pool.DirectoryOutputPool.java

/**
 * DOCUMENT ME!/*from  w  ww.  j av a  2 s.  co m*/
*
* @param ctClass DOCUMENT ME!
*
* @return DOCUMENT ME!
*/
protected File getOutputFile(CtClass ctClass) {
    File outputFile = new File(directory.getPath() + File.separatorChar
            + ctClass.getName().replace('.', File.separatorChar) + ".class");

    return outputFile;
}

From source file:com.android.tools.idea.editors.theme.ThemeEditorUtilsTest.java

private void compareWithGoldenFile(@NotNull String text, @NotNull String goldenFile) throws IOException {
    final File file = new File(goldenFile);
    String goldenText = FileUtils.readFileToString(file);
    goldenText = goldenText.replace("$$ANDROID_SDK_PATH", sdkPlatformPath);
    Matcher matcher = OPERATION_PATTERN.matcher(goldenText);
    StringBuffer processedGoldenText = new StringBuffer();

    while (matcher.find()) {
        String operation = matcher.group(1);
        String value = matcher.group(2);
        if (operation.equals("MAKE_URL")) {
            value = SdkUtils.fileToUrl(new File(value)).toString();
        } else if (operation.equals("MAKE_SYSTEM_DEPENDENT_PATH")) {
            value = PathUtil.toSystemDependentName(value);
            // escape all the backslashes so they don't get treated as backreferences by the regex engine later
            if (File.separatorChar == '\\') {
                value = value.replace("\\", "\\\\");
            }//from  w  w w .java2  s .  c o m
        } else {
            // Ignore if we don't know how to handle that - may be accidental pattern match
            continue;
        }
        matcher.appendReplacement(processedGoldenText, value);
    }
    matcher.appendTail(processedGoldenText);

    // Add line breaks after "<BR/>" tags for results that are easier to read.
    // Golden files are already have these line breaks, so there's no need to process them the same way.
    text = StringUtil.replace(text, "<BR/>", "<BR/>\n");

    assertEquals(String.format("Comparing to golden file %s failed", file.getCanonicalPath()),
            processedGoldenText.toString(), text);
}