Module scnvim.path

Path and platform related functions.

'/' is the path separator for all platforms.

Functions

get_system () Get the host system
get_cache_dir () Get the scnvim cache directory.
exists (path) Check if a path exists
is_symlink (path) Check if a file is a symbolic link.
get_asset (name) Get the path to a generated assset.
concat (...) Concatenate items using the path separator.
normalize (path) Normalize a path to use Unix style separators: '/'.
get_plugin_root_dir (plugin_name) Get the root dir of a plugin.
get_user_extension_dir () Get the SuperCollider user extension directory.
link (source, destination) Create a symbolic link.
unlink (link_path) Remove a symbolic link.

Fields

is_windows Returns true if current system is Windows otherwise false


Functions

get_system ()
Get the host system

Returns:

    'windows', 'macos' or 'linux'
get_cache_dir ()
Get the scnvim cache directory.

Returns:

    The absolute path to the cache directory
exists (path)
Check if a path exists

Parameters:

  • path The path to test

Returns:

    True if the path exists otherwise false
is_symlink (path)
Check if a file is a symbolic link.

Parameters:

  • path The path to test.

Returns:

    True if the path is a symbolic link otherwise false
get_asset (name)

Get the path to a generated assset.

  • snippets
  • syntax
  • tags

Parameters:

  • name The asset to get.

Returns:

    Absolute path to the asset

Usage:

    path.get_asset 'snippets'
concat (...)
Concatenate items using the path separator.

Parameters:

  • ... items to concatenate into a path

Usage:

    local cache_dir = path.get_cache_dir()
    local res = path.concat(cache_dir, 'subdir', 'file.txt')
    print(res) -- /Users/usr/.cache/nvim/scnvim/subdir/file.txt
normalize (path)
Normalize a path to use Unix style separators: '/'.

Parameters:

  • path The path to normalize.

Returns:

    The normalized path.
get_plugin_root_dir (plugin_name)
Get the root dir of a plugin.

Parameters:

  • plugin_name Optional plugin name, use nil to get scnvim root dir.

Returns:

    Absolute path to the plugin root dir.
get_user_extension_dir ()
Get the SuperCollider user extension directory.

Returns:

    Platform specific user extension directory.
link (source, destination)
Create a symbolic link.

Parameters:

  • source Absolute path to the source.
  • destination Absolute path to the destination.
unlink (link_path)
Remove a symbolic link.

Parameters:

  • link_path Absolute path for the file to unlink.

Fields

is_windows
Returns true if current system is Windows otherwise false
generated by LDoc 1.5.0 Last updated 2024-04-19 09:15:52