#
Class: FileA system which provides the ability to read and write files. There are no standard IO natives so this system relies on an exploit which ended up being sanctioned by Blizzard, and because of this there are some caveats.
- All files are confined to the
Documents\Warcraft III\CustomMapData
folder. - The only allowed file extensions are
.txt
and.pld
. - Generated files contain boilerplate JASS code.
- You cannot delete files but you can empty their contents.
example
// Write to the fileFile.write("data.txt", "Hello world!");
// Read it's contentsconst contents = File.read("data.txt");
// Display the contentsif (contents) { print(contents);}
#
Hierarchy- File
#
Methods#
readstatic read(filename: string): undefined | string
Read text from a file inside of the CustomMapData folder.
#
Parameters:Name | Type | Description |
---|---|---|
filename | string | The name of the file to read. |
Returns: undefined | string
Returns undefined when the file could not be read.
Defined in: system/file.ts:65
#
writestatic write(filename: string, contents: string): File
Write text to a file inside. All files are placed within the CustomMapData folder.
#
Parameters:Name | Type | Description |
---|---|---|
filename | string | The name of the file to write to. Supported extensions are .txt and .pld . |
contents | string | The contents to write to the file. |
Returns: File
Defined in: system/file.ts:108
#
writeRawstatic writeRaw(filename: string, contents: string, allowReading?: boolean): File
Write text to a file with the option to not include boilerplate for reading the file back.
#
Parameters:Name | Type | Default value | Description |
---|---|---|---|
filename | string | - | The name of the file to write to. Supported extensions are .txt and .pld . |
contents | string | - | The contents to write to the file. |
allowReading | boolean | false | If set to true, boilerplate code will be included for reading the file with File.read . |
Returns: File
Defined in: system/file.ts:81