src/main/java/org/fuin/srcgen4j/core/base/AbstractGenerator.java
protected final GeneratedFile getTargetFile(final String artifactName, final String filename, final String logInfo) {

        final Folder folder = getGeneratorConfig().findTargetFolder(artifactName);
        final File dir = folder.getCanonicalDir();
        final File file = new File(dir, filename);

        // Make sure the folder exists
        if (!dir.exists()) {
            if (folder.isCreate()) {
                dir.mkdirs();
            } else {
                throw new IllegalStateException("Directory '" + dir + "' does not exist, but configuration does not allow creation: "
                        + "<folder name=\"" + folder.getName() + "\" create=\"false\" ... />");
            }
        }
        // Make sure the parent directory for the file exists
        if (!file.getParentFile().exists()) {
            file.getParentFile().mkdirs();
        }
        if (file.exists() && !folder.overrideAllowed(file)) {
            // Skip file because override is not allowed
            return new GeneratedFile(file, logInfo, true);
        }

        return new GeneratedFile(file, logInfo);

    }
protected final GeneratedFile getTargetFile(final String artifactName, final String filename, final String logInfo) {

        final Folder folder = getGeneratorConfig().findTargetFolder(artifactName);
        final File dir = folder.getCanonicalDir();
        final File file = new File(dir, filename);

        // Make sure the folder exists
        if (!dir.exists()) {
            if (folder.isCreate()) {
                dir.mkdirs();
            } else {
                throw new IllegalStateException("Directory '" + dir + "' does not exist, but configuration does not allow creation: "
                        + "<folder name=\"" + folder.getName() + "\" create=\"false\" ... />");
            }
        }
        // Make sure the parent directory for the file exists
        if (!file.getParentFile().exists()) {
            file.getParentFile().mkdirs();
        }
        if (file.exists() && !folder.overrideAllowed(file)) {
            // Skip file because override is not allowed
            return new GeneratedFile(file, logInfo, true);
        }

        return new GeneratedFile(file, logInfo);

    }
protected final GeneratedFile getTargetFile ( final String artifactName , final String filename , final String logInfo ) { final Folder folder = getGeneratorConfig ( ) . findTargetFolder ( artifactName ) ; final File dir = folder . getCanonicalDir ( ) ; final File file = new File ( dir , filename ) ; // Make sure the folder exists
 if ( ! dir . exists ( ) ) { if ( folder . isCreate ( ) ) { dir . mkdirs ( ) ; } else { throw new IllegalStateException ( "Directory '" + dir + "' does not exist, but configuration does not allow creation: " + "<folder name=\"" + folder . getName ( ) + "\" create=\"false\" ... />" ) ; } } // Make sure the parent directory for the file exists
 if ( ! file . getParentFile ( ) . exists ( ) ) { file . getParentFile ( ) . mkdirs ( ) ; } if ( file . exists ( ) && ! folder . overrideAllowed ( file ) ) { // Skip file because override is not allowed
 return new GeneratedFile ( file , logInfo , true ) ; } return new GeneratedFile ( file , logInfo ) ; }
Returns the target file for a given artifact type and filename. This method takes care about eventually creating non existing
directories or protect existing files to be overridden.

@param artifactName
Type of the artifact to create - This has to refer to an existing entry in the configuration (Like '&lt;artifact
name="<i>artifactName</i>" ..&gt;').
@param filename
Name of the target file (without a path).
@param logInfo
Addition information to log.

@return File to write to or NULL if nothing should be written.
Returns the target file for a given artifact type and filename . This method takes care about eventually creating non existing directories or protect existing files to be overridden .