files.jamo (built in)

files: folders, paths, copying, moving, deleting and listing files. use "files.jamo"

read_file, write_file and exists are built in. These do the rest. The ones that change things answer true when they worked and false when they didn't, like a file that's in use, so a program can carry on and say why.

constFILES_FOLDER_BIT

const FILES_FOLDER_BIT = 16

constFILES_FIND_DATA_SIZE

const FILES_FIND_DATA_SIZE = 600

constFILES_NAME_AT

const FILES_NAME_AT = 44

constFILES_MOVE_FLAGS

const FILES_MOVE_FLAGS = 3

MOVEFILE_REPLACE_EXISTING and MOVEFILE_COPY_ALLOWED, so a move can go to another drive and replace what's there

constFILES_READ_ACCESS

const FILES_READ_ACCESS = -2147483648

constFILES_WRITE_ACCESS

const FILES_WRITE_ACCESS = 1073741824

constFILES_SHARE_ALL

const FILES_SHARE_ALL = 7

constFILES_OPEN_EXISTING

const FILES_OPEN_EXISTING = 3

constFILES_CREATE_ALWAYS

const FILES_CREATE_ALWAYS = 2

constFILES_NORMAL

const FILES_NORMAL = 128

constFILES_CHUNK

const FILES_CHUNK = 1048576

funcfiles_from_wide

func files_from_wide(place: int): string

Turns UTF-16 text that ends in a zero, the way Windows gives it, into Jamo's UTF-8 text

funcfiles_is_separator

func files_is_separator(code: int): bool

funcpath_join

func path_join(folder: string, name: string): string

A folder and a name joined with a backslash, like path_join("saves", "slot1.txt") gives saves\\slot1.txt

funcfiles_last_part

func files_last_part(path: string): int

Where the last part of the path starts

funcpath_name

func path_name(path: string): string

The last part of a path: path_name("games\\ship.png") is ship.png

funcpath_folder

func path_folder(path: string): string

The folder a path is in: path_folder("games\\ship.png") is games. A path with no folder gives ""

funcpath_ending

func path_ending(path: string): string

The ending after the name's last dot, like ".png", or "" when there isn't one

funccurrent_folder

func current_folder(): string

The folder the program is running in

funcis_folder

func is_folder(path: string): bool

funcfile_size

func file_size(path: string): int

A file's size in bytes, or -1 when there's no such file

funclist_files

func list_files(folder: string): [string]

The names of everything in a folder, files and folders alike, sorted. A folder that isn't there gives []

funcmake_folder

func make_folder(path: string): bool

Makes a folder, and any folders it's in that aren't there yet. True if it's there afterward

funcdelete_file

func delete_file(path: string): bool

funcdelete_folder

func delete_folder(path: string): bool

Deletes a folder, which must be empty

funccopy_file

func copy_file(from: string, to: string): bool

Copies a file, replacing one that's already at to

funcmove_file

func move_file(from: string, to: string): bool

Moves or renames a file or folder, replacing a file that's already at to

funcread_file_or

func read_file_or(path: string, fallback: string): string

The file's text, or fallback when it can't be read: it's missing, a folder, or in use

functry_write_file

func try_write_file(path: string, text: string): bool

Replaces the file with the text, and answers whether it worked