Discussion:
[dart-misc] Accessing resources inside polymer elements
Metronome
2015-06-26 01:18:36 UTC
Permalink
How do you read files from a compiled dart file?

I have a method like this:

void _getImages() {
List<String> images = new List<String>();
//var u=path.fromUri("web/images");
//print(u);
var f = new Directory("web/images");
f.list(recursive: false, followLinks: false)
.listen((FileSystemEntity entity) {
images.add(entity.path);
});
_createSlideElements(images);
}


However I get an error when running this in chrome:

Unsupported Operation Platform._operatingSystem

What is the correct way of setting this up? Eventually I want to be able
to pass the path into the component through the template.
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new

To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
Benjamin Strauß
2015-06-26 06:12:40 UTC
Permalink
To quote the api docs.

https://api.dartlang.org/apidocs/channels/be/dartdoc-viewer/dart:io

"The I/O library is used for Dart server applications, which run on a stand-alone Dart VM from the command line. This library does not work in browser-based applications."
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new

To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
Metronome
2015-07-02 08:02:30 UTC
Permalink
Well that does end up explaining things. Thank you.
Post by Metronome
How do you read files from a compiled dart file?
void _getImages() {
List<String> images = new List<String>();
//var u=path.fromUri("web/images");
//print(u);
var f = new Directory("web/images");
f.list(recursive: false, followLinks: false)
.listen((FileSystemEntity entity) {
images.add(entity.path);
});
_createSlideElements(images);
}
Unsupported Operation Platform._operatingSystem
What is the correct way of setting this up? Eventually I want to be able
to pass the path into the component through the template.
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new

To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
'William Hesse' via Dart Misc
2015-07-02 08:17:53 UTC
Permalink
Inside the Chrome browser, you can use the filesystem API, which gives
you a virtual file system to store things in. This is dead as a W3C
proposal, and will not be implemented on other browsers.

If you want access to the real file system on the machine, Chrome
web apps can access the extra chrome apis, which exit the browser's
sandbox and give you access to the underlying system.

https://developer.chrome.com/apps/fileSystem
Post by Metronome
Well that does end up explaining things. Thank you.
Post by Metronome
How do you read files from a compiled dart file?
void _getImages() {
List<String> images = new List<String>();
//var u=path.fromUri("web/images");
//print(u);
var f = new Directory("web/images");
f.list(recursive: false, followLinks: false)
.listen((FileSystemEntity entity) {
images.add(entity.path);
});
_createSlideElements(images);
}
Unsupported Operation Platform._operatingSystem
What is the correct way of setting this up? Eventually I want to be able
to pass the path into the component through the template.
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
To unsubscribe from this group and stop receiving emails from it, send an
--
William Hesse
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new

To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
Loading...