Posted 19 March 2012 - 11:56 PM
This mod adds file extensions to ComputerCraft. The advantage of extensions is that types of files can be identified by programs so that they do not attempt to use files they are not designed for. Three file extensions are included: .lua for programs, .txt for text files, and .api for APIs. More extensions can be added using the file extension API (ext.api). The API also includes other functions that allow programs to manipulate file extensions:
Spoiler
ext.get(sName) – returns extension or nilext.has(sName, sExt*) – returns boolean
ext.hide(sName) – returns sName without extension
ext.put(sName, sExt) – returns sName with extension sExt
ext.type(sName) – returns type as string
ext.define(sExt,sType) – returns boolean indicating success
ext.defined(sExt) – returns boolean and type if true
* = optional
Defined types are reset upon shutdown, so including definitions in a startup program is recommended.
Note that most non-core files must be renamed with an appropriate extension for them to work. If you define an extension for use with one of your programs, please post it on this thread so extensions can be standardized.
The mod can be downloaded with the link below; just press Ctrl+S.
https://docs.google....1SGdZSWxlR3M0QQ
Features
- Most core files were renamed to include an extension
- The os.loadAPI function requires a .api extension
- The run command always assumes an extension of .lua
- The edit command defaults to an extension of .lua
- The type command recognizes defined file extensions
- A file extension API and a corresponding help file were added