make Stream usable on non-sys targets

This commit is contained in:
2021-04-25 03:07:49 -06:00
parent f3590a0616
commit 1157294733

View File

@@ -1,6 +1,8 @@
package kiss; package kiss;
#if (sys || hxnodejs)
import sys.io.File; import sys.io.File;
#end
import haxe.ds.Option; import haxe.ds.Option;
using StringTools; using StringTools;
@@ -42,9 +44,11 @@ class Stream {
public var startOfLine = true; public var startOfLine = true;
#if (sys || hxnodejs)
public static function fromFile(file:String) { public static function fromFile(file:String) {
return new Stream(file, File.getContent(file)); return new Stream(file, File.getContent(file));
} }
#end
public static function fromString(content:String) { public static function fromString(content:String) {
return new Stream("string", content); return new Stream("string", content);