From a6f6d1caa1fb0fca85d9deca597191c85ed5db38 Mon Sep 17 00:00:00 2001 From: Michael Yan Date: Thu, 25 May 2023 13:53:18 +0800 Subject: [PATCH] Grails Bootstrap: adding new BuildSettings.GRAILS_APP_PATH property, it may be 'app' or 'grails-app' as default. --- .../main/groovy/grails/util/BuildSettings.groovy | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/grails-bootstrap/src/main/groovy/grails/util/BuildSettings.groovy b/grails-bootstrap/src/main/groovy/grails/util/BuildSettings.groovy index 066f0aabf9..eeb3926df2 100644 --- a/grails-bootstrap/src/main/groovy/grails/util/BuildSettings.groovy +++ b/grails-bootstrap/src/main/groovy/grails/util/BuildSettings.groovy @@ -204,6 +204,11 @@ class BuildSettings { */ public static final File GRAILS_APP_DIR + /** + * The Path of the Grails app directory + */ + public static final String GRAILS_APP_PATH + /** * Whether the application is running inside the development environment or deployed */ @@ -268,14 +273,12 @@ class BuildSettings { if (new File(BASE_DIR, 'app').exists()) { GRAILS_APP_DIR = new File(BASE_DIR, 'app') } - else if (new File(BASE_DIR, 'grails-app').exists()) { - GRAILS_APP_DIR = new File(BASE_DIR, 'grails-app') - } else { - GRAILS_APP_DIR = null + GRAILS_APP_DIR = new File(BASE_DIR, 'grails-app') } } - GRAILS_APP_DIR_PRESENT = GRAILS_APP_DIR?.exists() + GRAILS_APP_PATH = GRAILS_APP_DIR.absolutePath.substring(GRAILS_APP_DIR.absolutePath.lastIndexOf(File.separator) + 1) + GRAILS_APP_DIR_PRESENT = GRAILS_APP_DIR.exists() String projectTargetDir = System.getProperty(PROJECT_TARGET_DIR) if (projectTargetDir) {