Repository navigation
Commit 5691baa
[flutter_tools] Pass relative archive paths to pub cache preload (flutter#195077)
In `_DefaultPub._preloadPubCache`, `flutter_tools` previously passed the
full path of every `.tar.gz` archive in
`$FLUTTER_ROOT/.pub-preload-cache` to a single `dart pub cache preload`
command. On Windows, when `FLUTTER_ROOT` is located in a deeply nested
directory (~145+ characters), repeating the full archive path for all
~170 preloaded archives causes the command line to exceed Windows'
`CreateProcessW` 32,767-character limit and fail with OS error code
`206` (`ERROR_FILENAME_EXCED_RANGE`: `The filename or extension is too
long`).
Run `dart pub cache preload` with `workingDirectory:
preloadCacheDir.path` and pass only the archive basenames via
`_fileSystem.path.basename` so the command line remains well below the
Windows command-line length limit, and skip invoking `dart pub cache
preload` if no `.tar.gz` archives are present in `.pub-preload-cache`.
### Previous output
```text
Flutter failed to run "C:\Users\User\AppData\Local\Temp\...\bin\cache\dart-sdk\bin\dart pub --suppress-analytics cache preload C:\Users\User\AppData\Local\Temp\...\.pub-preload-cache\...". The filename or extension is too long.
ProcessException: The filename or extension is too long
Command: C:\Users\User\AppData\Local\Temp\...
```
### Current output
```text
Installed a.tar.gz in cache as a 1.0.0.
Installed b.tar.gz in cache as b 1.0.0.
```
Fixes flutter#1945701 parent 9ef3bb6 commit 5691baa
2 files changed
Lines changed: 73 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
685 | 685 | | |
686 | 686 | | |
687 | 687 | | |
688 | | - | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
689 | 692 | | |
690 | | - | |
691 | | - | |
692 | | - | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
693 | 704 | | |
694 | 705 | | |
695 | 706 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1041 | 1041 | | |
1042 | 1042 | | |
1043 | 1043 | | |
1044 | | - | |
1045 | | - | |
| 1044 | + | |
| 1045 | + | |
1046 | 1046 | | |
| 1047 | + | |
1047 | 1048 | | |
1048 | 1049 | | |
1049 | 1050 | | |
| |||
1084 | 1085 | | |
1085 | 1086 | | |
1086 | 1087 | | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
1087 | 1143 | | |
1088 | 1144 | | |
1089 | 1145 | | |
| |||
0 commit comments