* docs(core.common): add and improve documentation
* refactor(core.common): remove unused variable to get_height()
* docs(core.common): remove messy newlines
* docs(core.common): fix wording
* docs(core.common): use integer instead of number
Co-authored-by: Guldoman <giulio.lettieri@gmail.com>
* docs(core.common): update docs
the docs now follow the style in docs/ directory.
some of the changes suggested are also implemented.
* docs(core.common): fix typo
Co-authored-by: Guldoman <giulio.lettieri@gmail.com>
* docs(core.common): restyle annoatations
Extra whitespaces are removed and @overload is used whenever possible.
* docs(core.common): fix various documentation errors
* docs(core.common): simplify unicode description
* docs(core.common): fix return value
Co-authored-by: Guldoman <giulio.lettieri@gmail.com>
* docs(core.common): clarify common.bench for not being a benchmark
* docs(common): add disclaimer for numbers in common.serialize
---------
Co-authored-by: Guldoman <giulio.lettieri@gmail.com>
This allows to use the Unix separator without resulting in ugly
suggestions that added the Windows separator too.
For example:
Before: `data/` -> `data/\core\`
After: `data/` -> `data/core\`
When no `root` is specified and the initial `path` is empty, the initial
`path` becomes `.`.
This results in returned files/dirs that are prepended with `./`.
Now, in that case, `./` is removed.
This is needed because users could try to enable plugins with
`config.plugins.plugin_name = true`.
Before, this would result in `common.merge` throwing an error; now it
just returns a copy of the "base" table.
On windows paths belonging to network volumes will be gives like:
\\address\share-name\path
Now the code recognize these paths and treat them correctly.
Use the function defined in the "common" module.
Move the check for not-nil filename from common.normalize_path
to core.open_doc. In this latter the filename can be nil if a
new unnamed document is created.
It is reported that the built-in lua function os.remove(path) does
not removes empty directories on windows. To fix this a system.rmdir
function is introduced that calls a native win32 function.
Also common.rm(path, recursively) was added which wraps system.rmdir()
to easily delete an entire folder with all its contents.
Move the function mkdirp into common to be generally available.
Use the new common.mkdirp from create_user_directory() from
core/init.lua replacing previous parent directory creation code
within the function.
The previous mkdirp function did not work on Windows where
absolute paths starts with a drive letter. The code from
create_user_directory() did not have this problem but was wrong
in the way it was creating the nested directories.
The new implementation in common.mkdirp fix both problems.