Fix hardcoded references to conf directory
EbeanDynamicEvolutions has hardcoded references to the conf directory:
File evolutions = environment.getFile("conf/evolutions/" + key + "/1.sql");
Files.createDirectory(environment.getFile("conf/evolutions/" + key));
@benmccann @schmitch hey guys, I want to fix this problem but I'm not understanding how to get application conf folder and how to write some tests. Can you help me understand?
I was thinking to use Environment.rootPath() to get application root folder and then concat with /conf.
Do you think that is a good approach?

I haven't used Play in years. I'm afraid my memory from 2014 is rather fuzzy
@felipebonezi Look at this code from Play:
val evolution = {
// First try a file on the filesystem
val filename = Evolutions.fileName(db, paddedRevision)
environment.getExistingFile(filename).map(_.toURI)
}.orElse {
// If file was not found, try a resource on the classpath
val resourceName = Evolutions.resourceName(db, paddedRevision)
environment.resource(resourceName).map(url => url.toURI)
}
Evolutions.fileName(db, revision) also tries to access the evolutions file in the hardcoded conf folder.
/**
* Default evolutions directory location.
*/
def directoryName(db: String): String = s"conf/evolutions/${db}"
/**
* Default evolution file location.
*/
def fileName(db: String, revision: Int): String = s"${directoryName(db)}/${revision}.sql"
def fileName(db: String, revision: String): String = s"${directoryName(db)}/${revision}.sql"
however if that files does not exist if falls back to Evolutions.resourceName(db, revision) which does not include the hardcoded conf/ prefix (also here the resource gets loaded via environment.resource(...) which loads the resource from the classpath).
I think that is the only way to solve this problem here. There is no helper method which gives you the conf folder. That's because in Play you can disable the PlayLayoutPlugin and then there is no conf folder anymore, but instead the maven style folder structure is used and src/main/resources is used instead.
Also, because (depending if PlayLayoutPlugin is enable dor not) the conf folder or src/main/resources gets added to the classpath, so that fallback should be able to read the file, no matter where it is located.