Add stubs for AIR sys API support
This commit is contained in:
78
externs/air/sys/FileSystem.hx
Normal file
78
externs/air/sys/FileSystem.hx
Normal file
@@ -0,0 +1,78 @@
|
||||
package sys;
|
||||
|
||||
@:dce
|
||||
@:coreApi
|
||||
class FileSystem {
|
||||
|
||||
|
||||
public static function exists (path:String):Bool {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static function rename (path:String, newPath:String):Void {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static function stat (path:String):sys.FileStat {
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static function fullPath (relPath:String):String {
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static function absolutePath (relPath:String):String {
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static function isDirectory (path:String):Bool {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static function createDirectory (path:String):Void {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static function deleteFile (path:String):Void {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static function deleteDirectory (path:String):Void {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static function readDirectory (path:String):Array<String> {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
82
externs/air/sys/io/File.hx
Normal file
82
externs/air/sys/io/File.hx
Normal file
@@ -0,0 +1,82 @@
|
||||
package sys.io;
|
||||
|
||||
|
||||
import flash.filesystem.File in FlashFile;
|
||||
import flash.filesystem.FileMode;
|
||||
import flash.filesystem.FileStream;
|
||||
|
||||
|
||||
@:dce
|
||||
@:coreApi
|
||||
class File {
|
||||
|
||||
|
||||
public static function getContent (path:String):String {
|
||||
|
||||
var file = new FlashFile (path);
|
||||
var stream = new FileStream ();
|
||||
stream.open (file, FileMode.READ);
|
||||
var content = stream.readUTFBytes (stream.bytesAvailable);
|
||||
stream.close ();
|
||||
return content;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static function saveContent (path:String, content:String):Void {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static function getBytes (path:String):haxe.io.Bytes {
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static function saveBytes (path:String, bytes:haxe.io.Bytes):Void {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static function read (path:String, binary:Bool = true):FileInput {
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static function write (path:String, binary:Bool = true):FileOutput {
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static function append (path:String, binary:Bool = true):FileOutput {
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static function update (path:String, binary:Bool = true):FileOutput {
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static function copy (srcPath:String, dstPath:String):Void {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
75
externs/air/sys/io/FileInput.hx
Normal file
75
externs/air/sys/io/FileInput.hx
Normal file
@@ -0,0 +1,75 @@
|
||||
package sys.io;
|
||||
|
||||
|
||||
import haxe.io.Bytes;
|
||||
import haxe.io.Eof;
|
||||
import haxe.io.Error;
|
||||
|
||||
|
||||
@:coreApi
|
||||
class FileInput extends haxe.io.Input {
|
||||
|
||||
|
||||
private var fd:Int;
|
||||
private var pos:Int;
|
||||
|
||||
|
||||
@:allow(sys.io.File)
|
||||
private function new (fd:Int) {
|
||||
|
||||
this.fd = fd;
|
||||
pos = 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
override public function readByte ():Int {
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
override public function readBytes (s:Bytes, pos:Int, len:Int):Int {
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
override public function close ():Void {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function seek (p:Int, pos:FileSeek):Void {
|
||||
|
||||
switch (pos) {
|
||||
case SeekBegin:
|
||||
// this.pos = p;
|
||||
case SeekEnd:
|
||||
// this.pos = cast Fs.fstatSync(fd).size + p;
|
||||
case SeekCur:
|
||||
// this.pos += p;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function tell ():Int {
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function eof ():Bool {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
68
externs/air/sys/io/FileOutput.hx
Normal file
68
externs/air/sys/io/FileOutput.hx
Normal file
@@ -0,0 +1,68 @@
|
||||
package sys.io;
|
||||
|
||||
|
||||
import haxe.io.Bytes;
|
||||
import haxe.io.Eof;
|
||||
import haxe.io.Error;
|
||||
|
||||
|
||||
@:coreApi
|
||||
class FileOutput extends haxe.io.Output {
|
||||
|
||||
|
||||
private var fd:Int;
|
||||
private var pos:Int;
|
||||
|
||||
|
||||
@:allow(sys.io.File)
|
||||
private function new (fd:Int) {
|
||||
|
||||
this.fd = fd;
|
||||
pos = 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
override public function writeByte (b:Int):Void {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
override public function writeBytes (s:Bytes, pos:Int, len:Int):Int {
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
override public function close ():Void {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function seek (p:Int, pos:FileSeek):Void {
|
||||
|
||||
switch (pos) {
|
||||
case SeekBegin:
|
||||
// this.pos = p;
|
||||
case SeekEnd:
|
||||
// this.pos = cast Fs.fstatSync(fd).size + p;
|
||||
case SeekCur:
|
||||
// this.pos += p;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function tell ():Int {
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
<templatePath name="templates" />
|
||||
<source path="externs/air" if="air" />
|
||||
<haxeflag name="--macro" value="allowPackage('sys')" if="air" />
|
||||
<sample path="samples" unless="openfl" />
|
||||
|
||||
<haxelib name="nodejs" if="nodejs" />
|
||||
|
||||
Reference in New Issue
Block a user