Transfer URIs instead of platform-dependent file paths (#8701)

This commit is contained in:
Michael Goderbauer
2017-03-10 10:13:53 -08:00
committed by GitHub
parent 34ed3d2d24
commit 03d3186531
3 changed files with 5 additions and 7 deletions

View File

@@ -1 +1 @@
6e54f5e31f084d2e54a510959f68b89e4d2fdffd
e0c702e35300b7fdef975b9929df25e112fa9eda

View File

@@ -199,8 +199,7 @@ class ServiceProtocolDevFSOperations implements DevFSOperations {
'_writeDevFSFile',
params: <String, dynamic> {
'fsName': fsName,
// TODO(goderbauer): transfer real Uri (instead of file path) when remote end supports it
'path': deviceUri.toFilePath(windows: false),
'uri': deviceUri.toString(),
'fileContents': fileContents
},
);
@@ -268,9 +267,8 @@ class _DevFSHttpWriter {
final HttpClientRequest request = await _client.putUrl(httpAddress);
request.headers.removeAll(HttpHeaders.ACCEPT_ENCODING);
request.headers.add('dev_fs_name', fsName);
// TODO(goderbauer): transfer real Uri (instead of file path) when remote end supports it
request.headers.add('dev_fs_path_b64',
BASE64.encode(UTF8.encode(deviceUri.toFilePath(windows: false))));
request.headers.add('dev_fs_uri_b64',
BASE64.encode(UTF8.encode(deviceUri.toString())));
final Stream<List<int>> contents = content.contentsAsCompressedStream();
await request.addStream(contents);
final HttpClientResponse response = await request.close();

View File

@@ -299,7 +299,7 @@ class MockVMService extends BasicMock implements VMService {
_httpAddress = Uri.parse('http://127.0.0.1:${_server.port}');
_server.listen((HttpRequest request) {
final String fsName = request.headers.value('dev_fs_name');
final String devicePath = UTF8.decode(BASE64.decode(request.headers.value('dev_fs_path_b64')));
final String devicePath = UTF8.decode(BASE64.decode(request.headers.value('dev_fs_uri_b64')));
messages.add('writeFile $fsName $devicePath');
request.drain<List<int>>().then<Null>((List<int> value) {
request.response