Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/moteus/lua-path
File system path manipulation library
https://github.com/moteus/lua-path
filesystem lua
Last synced: about 1 month ago
JSON representation
File system path manipulation library
- Host: GitHub
- URL: https://github.com/moteus/lua-path
- Owner: moteus
- License: mit
- Created: 2013-03-03T09:26:50.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2021-01-07T13:28:11.000Z (almost 4 years ago)
- Last Synced: 2024-11-01T10:42:38.249Z (about 1 month ago)
- Topics: filesystem, lua
- Language: Lua
- Homepage:
- Size: 226 KB
- Stars: 77
- Watchers: 8
- Forks: 19
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-lua - lua-path - File system path manipulation library. (Filesystem)
README
# lua-path
[![Licence](http://img.shields.io/badge/Licence-MIT-brightgreen.svg)](LICENCE.txt)
[![Build Status](https://travis-ci.org/moteus/lua-path.png?branch=master)](https://travis-ci.org/moteus/lua-path)
[![Build Status](https://ci.appveyor.com/api/projects/status/okrhcb519rldjhn4?svg=true)](https://ci.appveyor.com/project/moteus/lua-path)
[![Coverage Status](https://coveralls.io/repos/moteus/lua-path/badge.png)](https://coveralls.io/r/moteus/lua-path)## Documentation
[View entire documentation here](http://moteus.github.io/path/index.html)
## Usage
```lua
local PATH = require "path"-- suppose we run on windows
assert(PATH.IS_WINDOWS)-- we can use system dependet function
print(PATH.user_home()) -- C:\Documents and Settings\Admin
print(PATH.currentdir()) -- C:\lua\5.1-- but we can use specific system path notation
local ftp_path = PATH.new('/')
print(ftp_path.join("/root", "some", "dir")) -- /root/some/dir-- All functions specific to system will fail
assert(not pcall( ftp_path.currentdir ) )
``````lua
-- clean currentdirlocal path = require "path"
path.each("./*", function(P, mode)
if mode == 'directory' then
path.rmdir(P)
else
path.remove(P)
end
end,{
param = "fm"; -- request full path and mode
delay = true; -- use snapshot of directory
recurse = true; -- include subdirs
reverse = true; -- subdirs at first
})
```