diff --git a/pkgs/code_assets/test/code_assets/config_test.dart b/pkgs/code_assets/test/code_assets/config_test.dart index 6ea73a7746..31a9075600 100644 --- a/pkgs/code_assets/test/code_assets/config_test.dart +++ b/pkgs/code_assets/test/code_assets/config_test.dart @@ -23,7 +23,9 @@ void main() async { late Uri fakeVcVars; setUp(() async { - final tempUri = Directory.systemTemp.uri; + final tempUri = + (await Directory.systemTemp.createTemp('code assets config temp ')) + .uri; outFile = tempUri.resolve('output.json'); outputDirectoryShared = tempUri.resolve('out_shared1/'); packageName = 'my_package'; diff --git a/pkgs/code_assets/test/code_assets/validation_test.dart b/pkgs/code_assets/test/code_assets/validation_test.dart index 2139307538..d8dd6591e1 100644 --- a/pkgs/code_assets/test/code_assets/validation_test.dart +++ b/pkgs/code_assets/test/code_assets/validation_test.dart @@ -19,7 +19,8 @@ void main() { late Uri packageRootUri; setUp(() async { - tempUri = (await Directory.systemTemp.createTemp()).uri; + tempUri = + (await Directory.systemTemp.createTemp('code assets temp ')).uri; outDirUri = tempUri.resolve('out/'); await Directory.fromUri(outDirUri).create(); outDirSharedUri = tempUri.resolve('out_shared/'); diff --git a/pkgs/data_assets/test/data_assets/validation_test.dart b/pkgs/data_assets/test/data_assets/validation_test.dart index b93475bca5..deddc699f9 100644 --- a/pkgs/data_assets/test/data_assets/validation_test.dart +++ b/pkgs/data_assets/test/data_assets/validation_test.dart @@ -17,7 +17,8 @@ void main() { late Uri packageRootUri; setUp(() async { - tempUri = (await Directory.systemTemp.createTemp()).uri; + tempUri = + (await Directory.systemTemp.createTemp('data assets temp ')).uri; outDirUri = tempUri.resolve('out/'); await Directory.fromUri(outDirUri).create(); outDirSharedUri = tempUri.resolve('out_shared/'); diff --git a/pkgs/ffigen/test/test_utils.dart b/pkgs/ffigen/test/test_utils.dart index d5665b1c89..098afecceb 100644 --- a/pkgs/ffigen/test/test_utils.dart +++ b/pkgs/ffigen/test/test_utils.dart @@ -156,7 +156,7 @@ String configPath(String directory, String file) => absPath(configPathForTest(directory, file)); /// Returns the temp directory used to store bindings generated by tests. -String tmpDir = path.join(packagePathForTests, 'test', '.temp'); +String tmpDir = path.join(packagePathForTests, 'test', '.temp with spaces'); /// Generates actual file using library and tests using [expect] with expected. /// diff --git a/pkgs/hooks/lib/src/test.dart b/pkgs/hooks/lib/src/test.dart index eb2c9ed7ed..a0db9848a7 100644 --- a/pkgs/hooks/lib/src/test.dart +++ b/pkgs/hooks/lib/src/test.dart @@ -52,7 +52,7 @@ Future testBuildHook({ linkingEnabled ??= false; const keepTempKey = 'KEEP_TEMPORARY_DIRECTORIES'; - final tempDir = await Directory.systemTemp.createTemp(); + final tempDir = await Directory.systemTemp.createTemp('hooks test '); try { // Deal with Windows temp folder aliases. diff --git a/pkgs/hooks/test/api/build_test.dart b/pkgs/hooks/test/api/build_test.dart index fae5715186..9b791625da 100644 --- a/pkgs/hooks/test/api/build_test.dart +++ b/pkgs/hooks/test/api/build_test.dart @@ -20,7 +20,8 @@ void main() async { late BuildInput input; setUp(() async { - tempUri = (await Directory.systemTemp.createTemp()).uri; + tempUri = (await Directory.systemTemp.createTemp('hooks api temp ')) + .uri; outFile = tempUri.resolve('output.json'); outDirUri = tempUri.resolve('out1/'); await Directory.fromUri(outDirUri).create(); diff --git a/pkgs/hooks/test/build_input_test.dart b/pkgs/hooks/test/build_input_test.dart index c8ea74ce1e..50259ab8df 100644 --- a/pkgs/hooks/test/build_input_test.dart +++ b/pkgs/hooks/test/build_input_test.dart @@ -20,7 +20,9 @@ void main() async { late Map inputJson; setUp(() async { - final tempUri = Directory.systemTemp.uri; + final tempUri = + (await Directory.systemTemp.createTemp('hooks build_input temp ')) + .uri; outFile = tempUri.resolve('output.json'); outDirUri = tempUri.resolve('out1/'); outputDirectoryShared = tempUri.resolve('out_shared1/'); diff --git a/pkgs/hooks/test/example/native_add_library_test.dart b/pkgs/hooks/test/example/native_add_library_test.dart index 3efe75d83e..e9738045bc 100644 --- a/pkgs/hooks/test/example/native_add_library_test.dart +++ b/pkgs/hooks/test/example/native_add_library_test.dart @@ -19,7 +19,8 @@ void main() async { const name = 'native_add_library'; setUp(() async { - tempUri = (await Directory.systemTemp.createTemp()).uri; + tempUri = (await Directory.systemTemp.createTemp('hooks example temp ')) + .uri; }); tearDown(() async { diff --git a/pkgs/hooks/test/example/native_dynamic_linking_test.dart b/pkgs/hooks/test/example/native_dynamic_linking_test.dart index 27c4ad2dbb..4e9c56a624 100644 --- a/pkgs/hooks/test/example/native_dynamic_linking_test.dart +++ b/pkgs/hooks/test/example/native_dynamic_linking_test.dart @@ -23,7 +23,8 @@ void main() async { const name = 'native_dynamic_linking'; setUp(() async { - tempUri = (await Directory.systemTemp.createTemp()).uri; + tempUri = (await Directory.systemTemp.createTemp('hooks example temp ')) + .uri; }); tearDown(() async { diff --git a/pkgs/hooks/test/helpers.dart b/pkgs/hooks/test/helpers.dart index 1a65f31688..7fea9715a9 100644 --- a/pkgs/hooks/test/helpers.dart +++ b/pkgs/hooks/test/helpers.dart @@ -18,7 +18,10 @@ Future inTempDir( String? prefix, bool keepTemp = false, }) async { - final tempDir = await Directory.systemTemp.createTemp(prefix); + final basePrefix = prefix ?? 'hooks_test'; + final effectivePrefix = + basePrefix.contains(' ') ? basePrefix : '$basePrefix with spaces '; + final tempDir = await Directory.systemTemp.createTemp(effectivePrefix); // Deal with Windows temp folder aliases. final tempUri = Directory( await tempDir.resolveSymbolicLinks(), diff --git a/pkgs/hooks/test/link_input_test.dart b/pkgs/hooks/test/link_input_test.dart index 25925702b0..bf35e79a0f 100644 --- a/pkgs/hooks/test/link_input_test.dart +++ b/pkgs/hooks/test/link_input_test.dart @@ -18,7 +18,9 @@ void main() async { late Map inputJson; setUp(() async { - final tempUri = Directory.systemTemp.uri; + final tempUri = + (await Directory.systemTemp.createTemp('hooks link_input temp ')) + .uri; outFile = tempUri.resolve('output.json'); outDirUri = tempUri.resolve('out1/'); outputDirectoryShared = tempUri.resolve('out_shared1/'); diff --git a/pkgs/hooks/test/validation_test.dart b/pkgs/hooks/test/validation_test.dart index 810f38d5e4..65051706b9 100644 --- a/pkgs/hooks/test/validation_test.dart +++ b/pkgs/hooks/test/validation_test.dart @@ -15,7 +15,8 @@ void main() { late Uri packageRootUri; setUp(() async { - tempUri = (await Directory.systemTemp.createTemp()).uri; + tempUri = (await Directory.systemTemp.createTemp('hooks test temp ')) + .uri; outDirUri = tempUri.resolve('out/'); await Directory.fromUri(outDirUri).create(); outDirSharedUri = tempUri.resolve('out_shared/'); diff --git a/pkgs/hooks_runner/test/helpers.dart b/pkgs/hooks_runner/test/helpers.dart index 00ec3fb2c2..4aba06f446 100644 --- a/pkgs/hooks_runner/test/helpers.dart +++ b/pkgs/hooks_runner/test/helpers.dart @@ -33,7 +33,10 @@ Future inTempDir( String? prefix, bool keepTemp = false, }) async { - final tempDir = await Directory.systemTemp.createTemp(prefix); + final basePrefix = prefix ?? 'hooks_runner_test'; + final effectivePrefix = + basePrefix.contains(' ') ? basePrefix : '$basePrefix with spaces '; + final tempDir = await Directory.systemTemp.createTemp(effectivePrefix); // Deal with Windows temp folder aliases. final tempUri = Directory( await tempDir.resolveSymbolicLinks(), @@ -58,7 +61,10 @@ Future inTempDir( } Future tempDirForTest({String? prefix, bool keepTemp = false}) async { - final tempDir = await Directory.systemTemp.createTemp(prefix); + final basePrefix = prefix ?? 'hooks_runner_test'; + final effectivePrefix = + basePrefix.contains(' ') ? basePrefix : '$basePrefix with spaces '; + final tempDir = await Directory.systemTemp.createTemp(effectivePrefix); // Deal with Windows temp folder aliases. final tempUri = Directory( await tempDir.resolveSymbolicLinks(), diff --git a/pkgs/jni/bin/setup.dart b/pkgs/jni/bin/setup.dart index 0c38dea7b9..8ba102380c 100644 --- a/pkgs/jni/bin/setup.dart +++ b/pkgs/jni/bin/setup.dart @@ -267,7 +267,8 @@ void main(List arguments) async { final jniDirUri = Uri.directory('.dart_tool').resolve('jni'); final jniDir = Directory.fromUri(jniDirUri); await jniDir.create(recursive: true); - final tempDir = await jniDir.createTemp('jni_native_build_'); + final tempDir = + await jniDir.createTemp('jni native build '); final cmakeArgs = []; cmakeArgs.addAll(options.cmakeArgs); diff --git a/pkgs/jni/tool/generate_ide_files.dart b/pkgs/jni/tool/generate_ide_files.dart index a973d245d1..a4d71a47a2 100644 --- a/pkgs/jni/tool/generate_ide_files.dart +++ b/pkgs/jni/tool/generate_ide_files.dart @@ -45,7 +45,8 @@ void main(List arguments) { return; } final generator = cmakeGeneratorNames[argResults['generator']]; - final tempDir = Directory.current.createTempSync('clangd_setup_temp_'); + final tempDir = + Directory.current.createTempSync('clangd setup temp '); final src = Directory.current.uri.resolve('src/'); try { runCommand( diff --git a/pkgs/jnigen/lib/src/tools/gradle_tools.dart b/pkgs/jnigen/lib/src/tools/gradle_tools.dart index afe2f9e187..96767da782 100644 --- a/pkgs/jnigen/lib/src/tools/gradle_tools.dart +++ b/pkgs/jnigen/lib/src/tools/gradle_tools.dart @@ -45,7 +45,7 @@ class GradleTools { deps, targetPath, ); - final tempDir = await currentDir.createTemp('maven_temp_'); + final tempDir = await currentDir.createTemp('maven temp '); await createStubProject(tempDir); final tempGradle = join(tempDir.path, 'temp_build.gradle.kts'); log.finer('using Gradle stub:\n$gradle'); diff --git a/pkgs/jnigen/test/generation_test.dart b/pkgs/jnigen/test/generation_test.dart index f5c065038b..f7a4afe36a 100644 --- a/pkgs/jnigen/test/generation_test.dart +++ b/pkgs/jnigen/test/generation_test.dart @@ -10,7 +10,8 @@ import 'package:test/test.dart'; void main() { test('Warn if non-jnigen-generated files exist in directory', () async { - final root = await Directory.current.createTemp(); + final root = + await Directory.current.createTemp('jnigen generation test '); final nonGenerated = await File.fromUri(root.uri.resolve('non_gen.dart')).create(); await nonGenerated.writeAsString('void main() {}'); diff --git a/pkgs/jnigen/test/test_util/bindings_test_setup.dart b/pkgs/jnigen/test/test_util/bindings_test_setup.dart index 508fc66acc..c90bc87d81 100644 --- a/pkgs/jnigen/test/test_util/bindings_test_setup.dart +++ b/pkgs/jnigen/test/test_util/bindings_test_setup.dart @@ -32,7 +32,9 @@ Future bindingsTestSetup() async { 'jni:setup', ]); tempClassDir = - Directory.current.createTempSync('jnigen_runtime_test_classpath_'); + Directory.current.createTempSync( + 'jnigen_runtime_test_classpath with spaces ', + ); await compileJavaFiles(Directory(simplePackageTestJava), tempClassDir); await runCommand('dart', [ 'run', diff --git a/pkgs/jnigen/test/test_util/test_util.dart b/pkgs/jnigen/test/test_util/test_util.dart index cb74c7f9a4..1db00b10e4 100644 --- a/pkgs/jnigen/test/test_util/test_util.dart +++ b/pkgs/jnigen/test/test_util/test_util.dart @@ -19,7 +19,10 @@ const largeTestTag = 'large_test'; const summarizerTestTag = 'summarizer_test'; Directory getTempDir(String prefix) { - return _currentDirectory.createTempSync(prefix); + final basePrefix = prefix.isEmpty ? 'jnigen_test_temp' : prefix; + final effectivePrefix = + basePrefix.contains(' ') ? basePrefix : '$basePrefix with spaces '; + return _currentDirectory.createTempSync(effectivePrefix); } Future isEmptyOrNotExistDir(String path) async { @@ -117,7 +120,8 @@ Future generateAndCompareBindings(Config config) async { final dartReferenceBindings = config.outputConfig.dartConfig.path.toFilePath(); final currentDir = Directory.current; - final tempDir = currentDir.createTempSync('jnigen_test_temp'); + final tempDir = + currentDir.createTempSync('jnigen_test_temp with spaces '); final singleFile = config.outputConfig.dartConfig.structure == OutputStructure.singleFile; final tempLib = singleFile @@ -133,7 +137,8 @@ Future generateAndCompareBindings(Config config) async { Future generateAndAnalyzeBindings(Config config, {Iterable confirmExists = const []}) async { - final tempDir = Directory.current.createTempSync('jnigen_test_temp'); + final tempDir = + Directory.current.createTempSync('jnigen_test_temp with spaces '); try { await _generateTempBindings(config, tempDir); final analyzeResult = Process.runSync('dart', ['analyze', tempDir.path]); diff --git a/pkgs/native_doc_dartifier/lib/src/code_processor.dart b/pkgs/native_doc_dartifier/lib/src/code_processor.dart index ec087e2d7f..8bed20d814 100644 --- a/pkgs/native_doc_dartifier/lib/src/code_processor.dart +++ b/pkgs/native_doc_dartifier/lib/src/code_processor.dart @@ -9,7 +9,8 @@ class CodeProcessor { final String _dartifiedCodeFileName = 'dartified_code.dart'; final String _helperCodeFileName = 'helper_code.dart'; - CodeProcessor() : _tempDir = Directory('${Directory.current.path}/temp') { + CodeProcessor() + : _tempDir = Directory('${Directory.current.path}/temp dir') { if (!_tempDir.existsSync()) { _tempDir.createSync(recursive: true); } diff --git a/pkgs/native_toolchain_c/test/helpers.dart b/pkgs/native_toolchain_c/test/helpers.dart index 4485ef5049..2b34f887a3 100644 --- a/pkgs/native_toolchain_c/test/helpers.dart +++ b/pkgs/native_toolchain_c/test/helpers.dart @@ -45,7 +45,10 @@ String testSuffix(List tags) => switch (tags) { const keepTempKey = 'KEEP_TEMPORARY_DIRECTORIES'; Future tempDirForTest({String? prefix, bool keepTemp = false}) async { - final tempDir = await Directory.systemTemp.createTemp(prefix); + final basePrefix = prefix ?? 'native_toolchain_c_test'; + final effectivePrefix = + basePrefix.contains(' ') ? basePrefix : '$basePrefix with spaces '; + final tempDir = await Directory.systemTemp.createTemp(effectivePrefix); // Deal with Windows temp folder aliases. final tempUri = Directory( await tempDir.resolveSymbolicLinks(), diff --git a/pkgs/objective_c/test/hook_build_path_test.dart b/pkgs/objective_c/test/hook_build_path_test.dart index ee08fe490f..778bfd0de7 100644 --- a/pkgs/objective_c/test/hook_build_path_test.dart +++ b/pkgs/objective_c/test/hook_build_path_test.dart @@ -17,7 +17,7 @@ void main() { 'build hook decodes percent-encoded package root paths', () async { final tempDir = await Directory.systemTemp.createTemp( - 'objective_c_hook_path', + 'objective_c_hook path', ); addTearDown(() => tempDir.delete(recursive: true)); diff --git a/pkgs/swift2objc/lib/src/config.dart b/pkgs/swift2objc/lib/src/config.dart index 4899983c1c..ab0fd5b401 100644 --- a/pkgs/swift2objc/lib/src/config.dart +++ b/pkgs/swift2objc/lib/src/config.dart @@ -6,7 +6,7 @@ import 'package:path/path.dart' as path; import 'ast/_core/interfaces/declaration.dart'; -const defaultTempDirPrefix = 'swift2objc_temp_'; +const defaultTempDirPrefix = 'swift2objc temp_'; const symbolgraphFileSuffix = '.symbols.json'; class Command { diff --git a/pkgs/swift2objc/test/integration/integration_test.dart b/pkgs/swift2objc/test/integration/integration_test.dart index 0a6f6c0757..8263f99a5d 100644 --- a/pkgs/swift2objc/test/integration/integration_test.dart +++ b/pkgs/swift2objc/test/integration/integration_test.dart @@ -27,7 +27,7 @@ void main([List? args]) { const outputSuffix = '_output.swift'; final thisDir = path.join(testDir, 'integration'); - final tempDir = path.join(thisDir, 'temp'); + final tempDir = path.join(thisDir, 'temp dir'); var regen = false; final testNames = []; diff --git a/pkgs/swift2objc/test/unit/filter_test.dart b/pkgs/swift2objc/test/unit/filter_test.dart index aefc6301ca..df248374bd 100644 --- a/pkgs/swift2objc/test/unit/filter_test.dart +++ b/pkgs/swift2objc/test/unit/filter_test.dart @@ -20,7 +20,7 @@ void main([List? args]) { group('Unit test for filter', () { final thisDir = p.join(testDir, 'unit'); - final tempDir = p.join(thisDir, 'temp'); + final tempDir = p.join(thisDir, 'temp dir'); final inputFile = p.join(thisDir, 'filter_test_input.swift'); void filterTest( diff --git a/pkgs/swift2objc/test/utils.dart b/pkgs/swift2objc/test/utils.dart index a80b7dc4ab..592e5d4edf 100644 --- a/pkgs/swift2objc/test/utils.dart +++ b/pkgs/swift2objc/test/utils.dart @@ -31,7 +31,10 @@ Future expectValidSwift(List files) async { '-emit-symbol-graph-dir', '.', ], - workingDirectory: Directory.systemTemp.createTempSync().absolute.path, + workingDirectory: + Directory.systemTemp.createTempSync('swift2objc swiftc temp ') + .absolute + .path, ); if (processResult.exitCode != 0) { diff --git a/pkgs/swiftgen/example/generate_code.dart b/pkgs/swiftgen/example/generate_code.dart index f85b532e19..619b03653e 100644 --- a/pkgs/swiftgen/example/generate_code.dart +++ b/pkgs/swiftgen/example/generate_code.dart @@ -51,7 +51,7 @@ Future main() async { ), ), ), - ).generate(logger: logger, tempDirectory: Uri.directory('temp')); + ).generate(logger: logger, tempDirectory: Uri.directory('temp dir')); final result = Process.runSync('swiftc', [ '-emit-library', diff --git a/pkgs/swiftgen/lib/src/util.dart b/pkgs/swiftgen/lib/src/util.dart index 9f180009bd..076266f77e 100644 --- a/pkgs/swiftgen/lib/src/util.dart +++ b/pkgs/swiftgen/lib/src/util.dart @@ -22,4 +22,6 @@ Future run( } Uri createTempDirectory() => - Uri.directory(Directory.systemTemp.createTempSync().path); + Uri.directory( + Directory.systemTemp.createTempSync('swiftgen temp ').path, + ); diff --git a/pkgs/swiftgen/test/integration/util.dart b/pkgs/swiftgen/test/integration/util.dart index 2f76de7dea..ea41684a38 100644 --- a/pkgs/swiftgen/test/integration/util.dart +++ b/pkgs/swiftgen/test/integration/util.dart @@ -42,7 +42,7 @@ class TestGenerator { TestGenerator(this.name) : isObjCCompatible = objCCompatibleTests.contains(name) { testDir = path.absolute(path.join(pkgDir, 'test/integration')); - tempDir = path.join(testDir, 'temp'); + tempDir = path.join(testDir, 'temp dir'); inputFile = path.join(testDir, '$name.swift'); wrapperFile = path.join(tempDir, '${name}_wrapper.swift'); outputFile = path.join(tempDir, '${name}_output.dart');