c85b11835c
fs: return true on success in mkdir
2024-04-07 07:11:46 +12:00
69f8fff3bd
fs: remove documentation comments
...
Transitioning to man pages.
2024-04-06 11:47:15 +13:00
fbcae8c3cb
fs: remove use of strdup
2024-04-01 17:50:10 +13:00
6034b6ee60
fs: use unlink(2) for removing files
...
remove(3) just calls unlink(2) when the path points to a file
2024-03-29 20:08:36 +13:00
6d47426ea6
fs: remove unnecessary comments
2024-03-28 09:46:21 +13:00
a87c36d61e
fs: init function "issymlink"
2024-03-24 15:32:03 +13:00
1c408c914e
fs: use fs.type backend for isdirectory and isfile
2024-03-24 15:31:27 +13:00
1c156e6f74
fs: init function "type"
...
Returns a string describing the given file's type.
2024-03-24 15:30:23 +13:00
5071aed152
fs: fix isfile documentation
2024-03-24 14:45:56 +13:00
2799d481d5
fs: remove unnecessary break
2024-04-12 09:10:18 +12:00
c620c39f0a
fs: use lstat over stat
2024-03-24 14:21:49 +13:00
a27ebcd8c3
fs: fix dirname documentation
2024-03-24 14:10:04 +13:00
a1c2f49232
fs: fix security issues in mkdir and mkpath
...
777 is writable to anyone, 755 is only writable to the owner/group
2024-03-24 14:06:56 +13:00
dac9418d8e
fs: split mkdir's recursive functionality into "mkpath"
2024-03-24 14:05:24 +13:00
78b55f2205
fs: fix memory leak in mkdir
2024-03-24 13:45:40 +13:00
5bd98fd137
fs: init function "entries"
2024-03-24 13:34:11 +13:00
d8519cc39f
fs: init function "status"
...
fs.status returns a table containing information concerning the status
of a file. Currently, the table includes the following information:
string path -- the given path to the file; the first argument
integer mode -- bitmask of file modes; see chmod(2)
integer uid -- owner of the file in UID form
integer gid -- owner group of the file in GID form
integer accessdate -- date the file was last accessed
integer modifydate -- date the file was last modified
integer chdate -- date the file's status last changed
Dates are given in the form of an integer number representing the
number of seconds since Jan 1, 1970 (unixtime).
For more information consult the definition of sys/stat.h
according to POSIX:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_stat.h.html
2024-03-20 16:00:46 +13:00
cfca6cf880
fs: include mode constants in the library table
2024-03-20 15:57:54 +13:00
30a1097bb0
tree: reformat
...
Done automatically by clang-format
2024-03-12 12:21:39 +13:00
669eb3fd28
tree: add clang-format off labels
...
When I figure out how to make clang-format ignore struct array
initialisers, I'll get rid of this.
2024-03-12 12:19:23 +13:00
e63e7a77a2
tree: specify the lua/ directory for includes
2024-03-11 12:37:50 +13:00
bbf9b88c66
tree: clean up whitespace and includes
2024-03-11 12:28:50 +13:00
7c7f7e588a
fs: fix build on musl libc
...
Remove leftover fts.h include from back when this file used
it. dirent.h is used as a replacement and, as part of the POSIX
standard, it should be used instead of the nonstandard fts.h.
2024-02-29 17:22:17 +13:00
8c5777fb98
tree: add standard copyright phrasing
...
Callisto - standalone scripting platform for Lua 5.4
Copyright (c) 2023-2024 Jeremy Baxter.
2024-02-19 10:16:45 +13:00
b5d61a25cb
rename the statically linked strlcpy to strbcpy
...
stands for "string bounds copy". Some systems like macOS include their
very own version of strlcpy and testing for that would require some
bloat like gnu automake so I'm just gonna rename it to prevent any
future conflicts. I only test on Linux and OpenBSD anyway. ;)
2024-01-25 19:47:57 +13:00
7b8c7632e9
fix up fs
2023-12-26 17:47:07 +13:00
058aa579ba
implement fs.remove, a recursive deletion function
2023-12-24 18:06:58 +13:00
2feddd9abc
improve fs docs and minor blunders
2023-12-24 15:05:52 +13:00
11f6a34ebf
merge fs and path libraries
2023-12-24 14:24:55 +13:00
2a75eab074
split the contents of fs.isfile and fs.isdirectory into its own function
...
and add more docs
2023-12-24 06:36:06 +13:00
fdcb8f794a
remove errors.h
2023-12-24 06:34:51 +13:00
790ad50f2b
implement fs.isfile and fs.isdirectory
2023-12-23 20:52:34 +13:00
aa7ae1d9ac
implement fs.copy, a file copying routine and clean up some docs in fs
2023-12-23 20:33:24 +13:00
cae9985747
change BSD ifndefs to __OpenBSD__ and remove unnecessary ifdefs
...
I'm not sure if any operating system other than OpenBSD
has strlcpy/strlcat. May need to use a configure script
for this later on.
2023-12-23 16:33:38 +13:00
290289cbf5
Refactor and fix up a lot of code
...
Don't tell the boss I forgot a couple of free()s...
2023-11-26 17:13:41 +13:00
7ff02fbbb1
Move fs.basename and fs.dirname into the path library, create errors.h
2023-08-10 08:14:05 +12:00
6590351e48
Add fs.mkdir and fs.rmdir functions, improve lfs.c
...
- Add fs.mkdir
- Add fs.rmdir
- Change library description
- Re-order #includes
- Use #defines for error messages
2023-08-01 13:35:02 +12:00
84f58824b9
Rename the file module to fs, and make some documentation changes
2023-07-31 07:33:23 +12:00