Skip to content

Commit

Permalink
Grails Shell: using BuildSettings.GRAILS_APP_DIR to load the project …
Browse files Browse the repository at this point in the history
…Classes in Completer
  • Loading branch information
rainboyan committed May 24, 2023
1 parent ac71932 commit 8f10eff
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2014-2022 the original author or authors.
* Copyright 2014-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -26,13 +26,9 @@ import grails.util.BuildSettings
class AllClassCompleter extends ClassNameCompleter {

AllClassCompleter() {
super(
new File(BuildSettings.BASE_DIR, 'grails-app').exists()
? new File(BuildSettings.BASE_DIR, 'grails-app').listFiles()?.findAll {
File f -> f.isDirectory() && !f.isHidden() && !f.name.startsWith('.') } as File[]
: new File(BuildSettings.BASE_DIR, 'app').listFiles()?.findAll {
File f -> f.isDirectory() && !f.isHidden() && !f.name.startsWith('.') } as File[]
)
super(BuildSettings.GRAILS_APP_DIR?.listFiles()?.findAll {
File f -> f.isDirectory() && !f.isHidden() && !f.name.startsWith('.')
} as File[])
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2014-2022 the original author or authors.
* Copyright 2014-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -32,9 +32,7 @@ import org.grails.io.support.Resource
class DomainClassCompleter extends ClassNameCompleter {

DomainClassCompleter() {
super(new File(BuildSettings.BASE_DIR, 'grails-app').exists()
? new File(BuildSettings.BASE_DIR, 'grails-app/domain')
: new File(BuildSettings.BASE_DIR, 'app/domain'))
super(new File(BuildSettings.GRAILS_APP_DIR, 'domain'))
}

@Override
Expand Down

0 comments on commit 8f10eff

Please sign in to comment.