diff --git a/.gitattributes b/.gitattributes index 00a51aff..e52aea20 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,6 +1,2 @@ -# -# https://help.github.com/articles/dealing-with-line-endings/ -# -# These are explicitly windows files and should use crlf -*.bat text eol=crlf - +# use LF line endings within the project +* text eol=lf diff --git a/src/main/scala/edu/ie3/powerFactory2psdm/util/Formatter.scala b/src/main/scala/edu/ie3/powerFactory2psdm/util/Formatter.scala index 0ae5d0dd..8b586de2 100644 --- a/src/main/scala/edu/ie3/powerFactory2psdm/util/Formatter.scala +++ b/src/main/scala/edu/ie3/powerFactory2psdm/util/Formatter.scala @@ -8,14 +8,16 @@ package edu.ie3.powerFactory2psdm.util import java.nio.file.{Files, Paths} import org.scalafmt.interfaces.Scalafmt +import java.io.File object Formatter { def format(str: String, fmtPath: Option[String]): String = { val classLoader = this.getClass.getClassLoader val scalafmt = Scalafmt.create(classLoader) + val configFile = new File(classLoader.getResource(".scalafmt.conf").getFile) val defaultConfigPath = - Paths.get(classLoader.getResource(".scalafmt.conf").getPath) + Paths.get(configFile.getPath) val defaultConfig = if (Files.exists(defaultConfigPath)) defaultConfigPath else Paths.get("") val config = fmtPath.fold(defaultConfig)(Paths.get(_))