Types
Url
Create a Url:
-- regular file
local url = Url("/root/Downloads/logo.png")
-- `bgm.mp3` from the archive `ost.zip`
local url = Url("archive:///root/ost.zip#bgm.mp3")
name
Filename of the url.
Type | string? |
stem
Filename without the extension.
Type | string? |
frag
Url fragment.
Let's say the url archive:///root/my-archive.zip#1.jpg
, the fragment 1.jpg
.
Type | string? |
parent
Parent directory.
Type | Url? |
is_regular
Whether the file represented by the url is a regular file.
Type | boolean |
is_search
Whether the file represented by the url is from a search result.
Type | boolean |
is_archive
Whether the file represented by the url is from an archive.
Type | boolean |
is_absolute
Whether the path represented by the url is absolute.
Type | boolean |
has_root
Whether the path represented by the url has a root.
Type | boolean |
join(self, another)
Join with another
.
In/Out | Type |
---|---|
self | Url |
another | Url | string |
Return | Url |
starts_with(self, another)
Whether the url starts with another
.
In/Out | Type |
---|---|
self | Url |
another | Url | string |
Return | boolean |
ends_with(self, another)
Whether the url ends with another
.
In/Out | Type |
---|---|
self | Url |
another | Url | string |
Return | boolean |
strip_prefix(self, another)
Strips the prefix of another
.
In/Out | Type |
---|---|
self | Url |
another | Url | string |
Return | Url |
__eq(self, another)
Whether the url is equal to another
.
In/Out | Type |
---|---|
self | Url |
another | Url |
Return | boolean |
__tostring(self)
Convert the url to string.
In/Out | Type |
---|---|
self | Url |
Return | string |
__concat(self, another)
Concatenate the url with another
.
In/Out | Type |
---|---|
self | Url |
another | string |
Return | Url |
Cha
Cha means one file's characteristics.
is_dir
Whether the file is a directory.
Type | boolean |
is_hidden
Whether the file is hidden.
Type | boolean |
is_link
Whether the file is a symlink.
Type | boolean |
is_orphan
Whether the file is a bad symlink, which points to a non-existent file.
Type | boolean |
is_dummy
Whether the file is dummy, which fails to load complete metadata, possibly the filesystem doesn't support it, such as FUSE.
Type | boolean |
is_block
Whether the file is a block device.
Type | boolean |
is_char
Whether the file is a character device.
Type | boolean |
is_fifo
Whether the file is a FIFO.
Type | boolean |
is_sock
Whether the file is a socket.
Type | boolean |
is_exec
Whether the file is executable.
Type | boolean |
is_sticky
Whether the file has the sticky bit set.
Type | boolean |
len
Length of the file in bytes.
If you want to get the size of a directory, use size()
instead.
Type | integer |
atime
Accessed time of the file in Unix timestamp.
Type | integer? |
btime
Birth time of the file in Unix timestamp.
Type | integer? |
mtime
Modified time of the file in Unix timestamp.
Type | integer? |
uid
User id of the file.
Type | integer? |
Available | Unix-like systems only |
gid
Group id of the file.
Type | integer? |
Available | Unix-like systems only |
nlink
Number of hard links to the file.
Type | integer? |
Available | Unix-like systems only |
perm(self)
Unix permission representation, such as drwxr-xr-x
.
Type | string? |
Available | Unix-like systems only |
File
url
Url
of the file.
Type | Url |
cha
Cha
of the file.
Type | Cha |
link_to
Url
of the file points to, if it's a symlink.
Type | Url? |
name
Name of the file.
Type | string |
Icon
text
Text of the icon.
Type | string |
style
Style of the icon.
Type | Style |
Error
code
Raw error code.
Type | integer |
__tostring(self)
Convert the error to string.
In/Out | Type |
---|---|
self | Error |
Return | string |
__concat(self, another)
Concatenate the error with another
.
In/Out | Type |
---|---|
self | Error |
another | string |
Return | Error |
Window
rows
Number of rows.
Type | integer |
cols
Number of columns.
Type | integer |
width
Width in pixels.
Type | integer |
height
Height in pixels.
Type | integer |