Home

Awesome

Native filesystem for LÖVE

nativefs replicates a subset of the love.filesystem API, but without LÖVE's path restrictions.

Available functions

nativefs

Links in this list point to their love.filesystem counterparts. All functions are designed to behave the same way as love.filesystem, but without the path restrictions that LÖVE imposes; i.e., they allow full access to the filesystem.

Additional nativefs functions

Functions that are not available in love.filesystem:

File

nativefs.newFile returns a File object that provides these functions:

Function names in this list are links to their LÖVE File counterparts. File is designed to work the same way as LÖVE's File objects.

Example

local nativefs = require("nativefs")

-- deletes all files in C:\Windows
local files = nativefs.getDirectoryItemsInfo("C:/Windows")
for i = 1, #files do
  if files[i].type == "file" then
    nativefs.remove("C:/Windows/" .. files[i].name)
  end
end

License

Copyright 2020 megagrump@pm.me

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.