Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
🐛 Use consist slashes when generating dep files
  • Loading branch information
AlexV525 committed May 28, 2025
commit 0951facf1c4e58957b3846a516efe850df6ed4c7
17 changes: 10 additions & 7 deletions packages/flutter_tools/lib/src/build_system/depfile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,19 @@ class DepfileService {
}

void _writeFilesToBuffer(List<File> files, StringBuffer buffer) {
final bool backslash = _fileSystem.path.style.separator == r'\';
for (final File outputFile in files) {
if (_fileSystem.path.style.separator == r'\') {
// backslashes and spaces in a depfile have to be escaped if the
// platform separator is a backslash.
final String path = outputFile.path.replaceAll(r'\', r'\\').replaceAll(r' ', r'\ ');
buffer.write(' $path');
// Escape spaces.
String path = _fileSystem.path.normalize(outputFile.path).replaceAll(r' ', r'\ ');
if (backslash) {
// Convert all path separators to backslashes.
// Backslashes in a depfile have to be escaped if the platform separator is a backslash.
path = path.replaceAll(RegExp(r'[/\\]'), r'\\');
} else {
final String path = outputFile.path.replaceAll(r' ', r'\ ');
buffer.write(' $path');
// Convert all path separators to forward slashes.
path = path.replaceAll(r'\', r'/');
}
buffer.write(' $path');
}
}

Expand Down