hard_drive
Important! Avoid editing the content of file objects already saved on a disk, as this bypasses checks for anything that might prevent saving. Instead, clone the file, make the changes to the clone, and attempt to save the clone with the same filename using save_file(). Additional useful procs for data files in particular are also available.
Vars | |
read_only | Whether drive is protected against changes |
---|---|
stored_files | List of stored files on this drive. DO NOT MODIFY DIRECTLY! |
Procs | |
can_store_file | Checks whether there is space to store file on the hard drive. |
can_write_file | Checks whether the file can be written to the drive. |
create_data_file | Use this proc to add Data file to the drive. |
create_file | Use this proc to add file to the drive. Contains necessary sanity checks. |
find_file_by_name | Tries to find the file by filename. Returns null on failure |
install_default_programs | Installs default programs on the drive |
recalculate_size | Loops through all stored files and recalculates used_capacity of this drive |
remove_file | Use this proc to remove file from the drive. Contains necessary sanity checks. |
rename_file | Use this proc to rename file on the drive. Contains necessary sanity checks. |
save_data_file | Use this proc to save Data file to the drive. |
save_file | Use this proc to add file or update it if it already exists. Contains necessary sanity checks. |
try_create_file | Use this proc to check if the file can be created. |
update_data_file | Use this proc to add data to a Data file on the drive. Unlike using save_data_file directly, this enforces exact file type match with existing file |
validate_name | Validates filename |
Var Details
read_only
Whether drive is protected against changes
stored_files
List of stored files on this drive. DO NOT MODIFY DIRECTLY!
Proc Details
can_store_file
Checks whether there is space to store file on the hard drive.
can_write_file
Checks whether the file can be written to the drive.
create_data_file
Use this proc to add Data file to the drive.
create_file
Use this proc to add file to the drive. Contains necessary sanity checks.
find_file_by_name
Tries to find the file by filename. Returns null on failure
install_default_programs
Installs default programs on the drive
recalculate_size
Loops through all stored files and recalculates used_capacity of this drive
remove_file
Use this proc to remove file from the drive. Contains necessary sanity checks.
rename_file
Use this proc to rename file on the drive. Contains necessary sanity checks.
save_data_file
Use this proc to save Data file to the drive.
save_file
Use this proc to add file or update it if it already exists. Contains necessary sanity checks.
try_create_file
Use this proc to check if the file can be created.
update_data_file
Use this proc to add data to a Data file on the drive. Unlike using save_data_file directly, this enforces exact file type match with existing file
validate_name
Validates filename