Forward slashes in RunConfiguration.getProjectDir cause issues

I would avoid using / and \ as file path separator at all.

Using Java8 Path API, you can write code without / and \ at all. See the following example.

import java.nio.file.Files
import java.nio.file.Path
import java.nio.file.Paths

String projectDir = RunConfiguration.getProjectDir()
Path projectPath = Paths.get(projectDir)
Path dataFilesPath = projectPath.resolve('Data Files')   // you do not need / and \ here
File dataFilesDir = dataFilesPath.toFile()
// use dataFilesDir as you want

This code is OS-independent. This would work on Windows, Mac and Linux without any change.

3 Likes