Update Files

This commit is contained in:
2025-01-22 16:18:30 +01:00
parent ed4603cf95
commit a36294b518
16718 changed files with 2960346 additions and 0 deletions

View File

@ -0,0 +1,132 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package sys.io;
/**
API for reading and writing files.
See `sys.FileSystem` for the complementary file system API.
**/
extern class File {
/**
Retrieves the content of the file specified by `path` as a String.
If the file does not exist or can not be read, an exception is thrown.
`sys.FileSystem.exists` can be used to check for existence.
If `path` is null, the result is unspecified.
**/
static function getContent(path:String):String;
/**
Stores `content` in the file specified by `path`.
If the file cannot be written to, an exception is thrown.
If `path` or `content` are null, the result is unspecified.
**/
static function saveContent(path:String, content:String):Void;
/**
Retrieves the binary content of the file specified by `path`.
If the file does not exist or can not be read, an exception is thrown.
`sys.FileSystem.exists` can be used to check for existence.
If `path` is null, the result is unspecified.
**/
static function getBytes(path:String):haxe.io.Bytes;
/**
Stores `bytes` in the file specified by `path` in binary mode.
If the file cannot be written to, an exception is thrown.
If `path` or `bytes` are null, the result is unspecified.
**/
static function saveBytes(path:String, bytes:haxe.io.Bytes):Void;
/**
Returns an `FileInput` handle to the file specified by `path`.
If `binary` is true, the file is opened in binary mode. Otherwise it is
opened in non-binary mode.
If the file does not exist or can not be read, an exception is thrown.
Operations on the returned `FileInput` handle read on the opened file.
File handles should be closed via `FileInput.close` once the operation
is complete.
If `path` is null, the result is unspecified.
**/
static function read(path:String, binary:Bool = true):FileInput;
/**
Returns an `FileOutput` handle to the file specified by `path`.
If `binary` is true, the file is opened in binary mode. Otherwise it is
opened in non-binary mode.
If the file cannot be written to, an exception is thrown.
Operations on the returned `FileOutput` handle write to the opened file.
If the file existed, its previous content is overwritten.
File handles should be closed via `FileOutput.close` once the operation
is complete.
If `path` is null, the result is unspecified.
**/
static function write(path:String, binary:Bool = true):FileOutput;
/**
Similar to `sys.io.File.write`, but appends to the file if it exists
instead of overwriting its contents.
**/
static function append(path:String, binary:Bool = true):FileOutput;
/**
Similar to `sys.io.File.append`. While `append` can only seek or write
starting from the end of the file's previous contents, `update` can
seek to any position, so the file's previous contents can be
selectively overwritten.
**/
static function update(path:String, binary:Bool = true):FileOutput;
/**
Copies the contents of the file specified by `srcPath` to the file
specified by `dstPath`.
If the `srcPath` does not exist or cannot be read, or if the `dstPath`
file cannot be written to, an exception is thrown.
If the file at `dstPath` exists, its contents are overwritten.
If `srcPath` or `dstPath` are null, the result is unspecified.
**/
static function copy(srcPath:String, dstPath:String):Void;
}

View File

@ -0,0 +1,32 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package sys.io;
/**
Use `sys.io.File.read` to create a `FileInput`.
**/
extern class FileInput extends haxe.io.Input {
function seek(p:Int, pos:FileSeek):Void;
function tell():Int;
function eof():Bool;
}

View File

@ -0,0 +1,31 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package sys.io;
/**
Use `sys.io.File.write` to create a `FileOutput`.
**/
extern class FileOutput extends haxe.io.Output {
function seek(p:Int, pos:FileSeek):Void;
function tell():Int;
}

View File

@ -0,0 +1,29 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package sys.io;
enum FileSeek {
SeekBegin;
SeekCur;
SeekEnd;
}

View File

@ -0,0 +1,81 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package sys.io;
extern class Process {
/**
Standard output. The output stream where a process writes its output data.
**/
var stdout(default, null):haxe.io.Input;
/**
Standard error. The output stream to output error messages or diagnostics.
**/
var stderr(default, null):haxe.io.Input;
/**
Standard input. The stream data going into a process.
**/
var stdin(default, null):haxe.io.Output;
/**
Construct a `Process` object, which run the given command immediately.
Command arguments can be passed in two ways: 1. using `args`, 2. appending to `cmd` and leaving `args` as `null`.
1. When using `args` to pass command arguments, each argument will be automatically quoted, and shell meta-characters will be escaped if needed.
`cmd` should be an executable name that can be located in the `PATH` environment variable, or a path to an executable.
2. When `args` is not given or is `null`, command arguments can be appended to `cmd`. No automatic quoting/escaping will be performed. `cmd` should be formatted exactly as it would be when typed at the command line.
It can run executables, as well as shell commands that are not executables (e.g. on Windows: `dir`, `cd`, `echo` etc).
`detached` allows the created process to be standalone. You cannot communicate with it but you can look at its exit code. Not supported on php.
`close()` should be called when the `Process` is no longer used.
**/
function new(cmd:String, ?args:Array<String>, ?detached:Bool):Void;
/**
Return the process ID.
**/
function getPid():Int;
/**
Query the exit code of the process.
If `block` is true or not specified, it will block until the process terminates.
If `block` is false, it will return either the process exit code if it's already terminated or null if it's still running.
If the process has already exited, return the exit code immediately.
**/
function exitCode(block:Bool = true):Null<Int>;
/**
Close the process handle and release the associated resources.
All `Process` fields should not be used after `close()` is called.
**/
function close():Void;
/**
Kill the process.
**/
function kill():Void;
}