Projects >> cgeo >>1712dd52cb8a47d24265d0ba33ad2fda7e87657f

Chunk
Conflicting content
    }

    public static void listDir(final List result, final File directory, final FileSelector chooser, final Handler feedBackHandler) {
<<<<<<< HEAD
=======
        listDirInternally(result, directory, chooser, feedBackHandler, 0);
    }
>>>>>>> 99a29dff4e97448ee4b52de8c00001873c0c4b4b

    private static void listDirInternally(final List result, final File directory, final FileSelector chooser, final Handler feedBackHandler, final int depths) {
        if (directory == null || !directory.isDirectory() || !directory.canRead()
Solution content
    }

    public static void listDir(final List result, final File directory, final FileSelector chooser, final Handler feedBackHandler) {
        listDirInternally(result, directory, chooser, feedBackHandler, 0);
    }

    private static void listDirInternally(final List result, final File directory, final FileSelector chooser, final Handler feedBackHandler, final int depths) {
        if (directory == null || !directory.isDirectory() || !directory.canRead()
File
FileUtils.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Chunk
Conflicting content
     * 
     * which does not yet exist.
     */
<<<<<<< HEAD
    public static File getUniqueNamedFile(final File file) {
        if (!file.exists()) {
            return file;
        }
        final String baseNameAndPath = file.getPath();
        final String prefix = StringUtils.substringBeforeLast(baseNameAndPath, ".") + "_";
        final String extension = "." + StringUtils.substringAfterLast(baseNameAndPath, ".");
        for (int i = 1; i < Integer.MAX_VALUE; i++) {
            final File numbered = new File(prefix + i + extension);
            if (!numbered.exists()) {
                return numbered;
            }
        }
        throw new IllegalStateException("Unable to generate a non-existing file name");
=======
    public static File getUniqueNamedFile(final String baseNameAndPath) {
        final String extension = StringUtils.substringAfterLast(baseNameAndPath, ".");
        final String pathName = StringUtils.substringBeforeLast(baseNameAndPath, ".");
        int number = 1;
        while (new File(getNumberedFileName(pathName, extension, number)).exists()) {
            number++;
        }
        return new File(getNumberedFileName(pathName, extension, number));
    }

    private static String getNumberedFileName(final String pathName, final String extension, final int number) {
        return pathName + (number > 1 ? "_" + Integer.toString(number) : "") + "." + extension;
>>>>>>> 99a29dff4e97448ee4b52de8c00001873c0c4b4b
    }

    /**
Solution content
     * 
     * which does not yet exist.
     */
    public static File getUniqueNamedFile(final File file) {
        if (!file.exists()) {
            return file;
        }
        final String baseNameAndPath = file.getPath();
        final String prefix = StringUtils.substringBeforeLast(baseNameAndPath, ".") + "_";
        final String extension = "." + StringUtils.substringAfterLast(baseNameAndPath, ".");
        for (int i = 1; i < Integer.MAX_VALUE; i++) {
            final File numbered = new File(prefix + i + extension);
            if (!numbered.exists()) {
                return numbered;
            }
        }
        throw new IllegalStateException("Unable to generate a non-existing file name");
    }

    /**
File
FileUtils.java
Developer's decision
Version 1
Kind of conflict
For statement
If statement
Method declaration
Method invocation
Method signature
Return statement
Throw statement
Variable