@@ -37,6 +37,9 @@ import "context.dart";
37
37
const _resourceZipUrl =
38
38
"https://github.com/buijs-dev/klutter-dart/raw/develop/resources.zip" ;
39
39
40
+ const _resourceTarUrl =
41
+ "https://github.com/buijs-dev/klutter-dart/raw/develop/resources.tar.gz" ;
42
+
40
43
/// Task to prepare a flutter project for using klutter plugins.
41
44
///
42
45
/// {@category consumer}
@@ -108,14 +111,18 @@ Future<void> _producerInit(
108
111
..setupExample;
109
112
}
110
113
111
- /// Download [_resourceZipUrl] and return the unzipped directory.
114
+ /// Download [_resourceZipUrl] or [_resourceTarUrl]
115
+ /// and return the unzipped directory.
112
116
Future <Directory > _downloadResourcesZipOrThrow (String pathToRoot) async {
113
117
final cache = Directory (pathToRoot.normalize).kradleCache..maybeCreate;
114
118
final target = cache.resolveDirectory ("init.resources" );
115
119
final zip = target.resolveFile ("resources.zip" )
116
120
..maybeDelete
117
121
..createSync (recursive: true );
118
- await downloadOrThrow (_resourceZipUrl, zip, target);
122
+ final endpoint = platform.isLinux
123
+ ? _resourceTarUrl
124
+ : _resourceZipUrl;
125
+ await downloadOrThrow (endpoint, zip, target);
119
126
120
127
if (! target.existsSync ()) {
121
128
throw const KlutterException ("Failed to download resources.zip" );
@@ -126,16 +133,23 @@ Future<Directory> _downloadResourcesZipOrThrow(String pathToRoot) async {
126
133
"Failed to download resources (no content found)" );
127
134
}
128
135
136
+ print ("content dowloaded:" );
137
+ target.listSync ().map ((e) => e.path).toList ().forEach ((e) {
138
+ print (e);
139
+ });
129
140
return target;
130
141
}
131
142
132
- /// Download the flutter sdk or throw [KlutterException] on failure.
143
+ /// Download the resources or throw [KlutterException] on failure.
133
144
Future <void > downloadOrThrow (
134
145
String endpoint, File zip, Directory target) async {
135
146
print ("resources download started: $endpoint " );
136
147
await download (endpoint, zip);
148
+ print ("resources download done: ${zip .lengthSync ()}" );
137
149
if (zip.existsSync ()) {
150
+ print ("resources download unzipping" );
138
151
await unzip (zip, target..maybeCreate);
152
+ print ("resources download unzipped" );
139
153
zip.deleteSync ();
140
154
}
141
155
0 commit comments