| // Copyright 2013 The Flutter Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| import 'dart:io'; |
| |
| import 'package:path/path.dart' as path; |
| |
| String _flutterBuildDirectoryPath() { |
| assert(Platform.environment.containsKey('FLUTTER_BUILD_DIRECTORY')); |
| |
| return Platform.environment['FLUTTER_BUILD_DIRECTORY']!; |
| } |
| |
| const String _testPath = 'gen/flutter/lib/spirv/test'; |
| |
| /// Gets the [Directory] of .spv files that are generated by `lib/spirv/test`. |
| /// |
| /// `folderName` is a leaf folder within the generated directory. |
| Directory spvDirectory(String leafFolderName) { |
| return Directory(path.joinAll(<String>[ |
| ...path.split(_flutterBuildDirectoryPath()), |
| ...path.split(_testPath), |
| leafFolderName, |
| ])); |
| } |
| |
| /// Gets a specific .spv [File] that is generated by `lib/spirv/test`. |
| /// |
| /// `folderName` is the leaf folder within the generated directory. |
| /// |
| /// `fileName` is the name of the filer within `folderName`. |
| File spvFile(String folderName, String fileName) { |
| return File(path.joinAll(<String>[ |
| ...path.split(_flutterBuildDirectoryPath()), |
| ...path.split(_testPath), |
| folderName, |
| fileName, |
| ])); |
| } |