|
1 | 1 | package ftl.run.common |
2 | 2 |
|
3 | 3 | import com.google.cloud.storage.Storage |
4 | | -import ftl.args.AndroidArgs |
5 | 4 | import ftl.args.IArgs |
6 | 5 | import ftl.config.FtlConstants |
7 | | -import ftl.gc.GcStorage |
8 | 6 | import ftl.json.MatrixMap |
| 7 | +import ftl.gc.GcStorage |
9 | 8 | import ftl.util.Artifacts |
10 | 9 | import ftl.util.MatrixState |
11 | | -import ftl.util.ObjPath |
| 10 | +import java.nio.file.Path |
| 11 | +import java.nio.file.Paths |
12 | 12 | import kotlinx.coroutines.Dispatchers |
13 | 13 | import kotlinx.coroutines.coroutineScope |
14 | 14 | import kotlinx.coroutines.joinAll |
15 | 15 | import kotlinx.coroutines.launch |
16 | | -import java.nio.file.Path |
17 | | -import java.nio.file.Paths |
18 | 16 |
|
19 | 17 | internal suspend fun fetchArtifacts(matrixMap: MatrixMap, args: IArgs) = coroutineScope { |
20 | 18 | println("FetchArtifacts") |
@@ -64,17 +62,13 @@ internal suspend fun fetchArtifacts(matrixMap: MatrixMap, args: IArgs) = corouti |
64 | 62 |
|
65 | 63 | internal fun getDownloadPath(args: IArgs, blobPath: String): Path { |
66 | 64 | val localDir = args.localResultDir |
67 | | - val p = if (args is AndroidArgs) |
68 | | - ObjPath.parse(blobPath) else |
69 | | - ObjPath.legacyParse(blobPath) |
| 65 | + val parsed = Paths.get(blobPath) |
| 66 | + val objName = if (args.useLocalResultDir()) "" else parsed.getName(0).toString() |
| 67 | + // for iOS it is shardName, remove this comment after FTL introduce server side sharding for iOS |
| 68 | + val matrixName = parsed.getName(1).toString() |
| 69 | + val deviceName = parsed.getName(2).toString() |
| 70 | + val filePathName = if (args.keepFilePath) parsed.parent.drop(3).joinToString("/") else "" |
| 71 | + val fileName = parsed.fileName.toString() |
70 | 72 |
|
71 | | - // Store downloaded artifacts at device root. |
72 | | - return Paths.get( |
73 | | - localDir, |
74 | | - if (args.useLocalResultDir().not()) p.objName else "", |
75 | | - p.shardName, |
76 | | - p.deviceName, |
77 | | - if (args.keepFilePath) p.filePathName else "", |
78 | | - p.fileName |
79 | | - ) |
| 73 | + return Paths.get("$localDir/$objName/$matrixName/$deviceName/$filePathName/$fileName") |
80 | 74 | } |
0 commit comments