@@ -98,8 +98,7 @@ trait BloopHelpers {
98
98
val all = files.map { f =>
99
99
Task {
100
100
val configFile = f.path.underlying
101
- val oldWorkspace = AbsolutePath (baseDir)
102
- loadTestProjectFromDisk(configFile, oldWorkspace.syntax, workspace.syntax)
101
+ loadTestProjectFromDisk(configFile, workspace.syntax)
103
102
}
104
103
}
105
104
@@ -117,25 +116,28 @@ trait BloopHelpers {
117
116
118
117
private def loadTestProjectFromDisk (
119
118
configFile : Path ,
120
- previousBaseDir : String ,
121
119
newBaseDir : String
122
120
): TestProject = {
123
121
val bytes = Files .readAllBytes(configFile)
124
- val contents = new String (bytes, StandardCharsets .UTF_8 )
125
- val newContents = contents.replace(previousBaseDir, newBaseDir)
126
- import java .nio .file .StandardOpenOption
127
- Files .write(
128
- configFile,
129
- newContents.getBytes(StandardCharsets .UTF_8 ),
130
- StandardOpenOption .TRUNCATE_EXISTING ,
131
- StandardOpenOption .SYNC ,
132
- StandardOpenOption .WRITE
133
- )
134
-
135
- bloop.config.read(newContents.getBytes(StandardCharsets .UTF_8 )) match {
122
+ val contents = new String (bytes)
123
+
124
+ bloop.config.read(contents.getBytes()).flatMap { cfg =>
125
+ import java .nio .file .StandardOpenOption
126
+ val previousBaseDir = cfg.project.workspaceDir.get.toString()
127
+ val newContents = contents.replace(" \" " + previousBaseDir, " \" " + newBaseDir)
128
+ Files .write(
129
+ configFile,
130
+ newContents.getBytes,
131
+ StandardOpenOption .TRUNCATE_EXISTING ,
132
+ StandardOpenOption .SYNC ,
133
+ StandardOpenOption .WRITE
134
+ )
135
+ bloop.config.read(newContents.getBytes())
136
+ } match {
136
137
case Left (error) => throw error
137
138
case Right (file) => TestProject (file.project, None )
138
139
}
140
+
139
141
}
140
142
141
143
final class TestState (val state : State ) {
0 commit comments