mirror of
https://github.com/lunarmodules/luafilesystem.git
synced 2026-07-23 19:43:06 +00:00
Compare commits
52 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a186cca583 | ||
|
|
31dcb88b12 | ||
|
|
0951178220 | ||
|
|
268c2d3830 | ||
|
|
b6abbb63b1 | ||
|
|
71ae24046c | ||
|
|
ff2cbc21f1 | ||
|
|
97b522ec12 | ||
|
|
472cd783d7 | ||
|
|
912e06714f | ||
|
|
e4eae33de5 | ||
|
|
3c8d96b77f | ||
|
|
9cbe5cba90 | ||
|
|
772fe81c67 | ||
|
|
f77f24850b | ||
|
|
211c2a5d89 | ||
|
|
7c6e1b013c | ||
|
|
68c624c686 | ||
|
|
41e59da31b | ||
|
|
842505b6a3 | ||
|
|
3e879ffba1 | ||
|
|
4f7e1b5a49 | ||
|
|
a5336d294d | ||
|
|
6048863a96 | ||
|
|
1a61e5284d | ||
|
|
7cb7d86dc4 | ||
|
|
94700f7c18 | ||
|
|
53d2acc517 | ||
|
|
6b11508ea9 | ||
|
|
58cf8c9449 | ||
|
|
04ba8d686a | ||
|
|
04bdaf9a1e | ||
|
|
1dfb8c41e8 | ||
|
|
37d8524e7e | ||
|
|
e5f06c270a | ||
|
|
884b52a3b2 | ||
|
|
1b5073419f | ||
|
|
fe964e013d | ||
|
|
12d1692f14 | ||
|
|
de87218e97 | ||
|
|
a23cadf009 | ||
|
|
220d38c7d1 | ||
|
|
a066a03f1c | ||
|
|
d37fc8101a | ||
|
|
754576dee6 | ||
|
|
d399961536 | ||
|
|
8a7796ec17 | ||
|
|
dd6911ef15 | ||
|
|
55ed1b14ab | ||
|
|
a84d81bc52 | ||
|
|
a90ec38133 | ||
|
|
ee5942d810 |
78
.github/workflows/ci.yml
vendored
Normal file
78
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
name: ci
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
TestMatrix:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
lua-version: ["5.4", "5.3", "5.2", "5.1", "luajit"]
|
||||||
|
os: ["ubuntu-latest"]
|
||||||
|
libflag: ["-shared --coverage"]
|
||||||
|
include:
|
||||||
|
- os: "macos-latest"
|
||||||
|
lua-version: "5.4"
|
||||||
|
libflag: "-bundle -undefined dynamic_lookup -all_load --coverage"
|
||||||
|
- os: "windows-latest"
|
||||||
|
toolchain: "msvc"
|
||||||
|
lua-version: "5.4"
|
||||||
|
- os: "windows-latest"
|
||||||
|
lua-version: "luajit"
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@master
|
||||||
|
|
||||||
|
- name: Setup MSVC
|
||||||
|
# 'luarocks/gh-actions-lua' step requires msvc to build PUC-Rio Lua
|
||||||
|
# versions on Windows (LuaJIT will be built using MinGW/gcc).
|
||||||
|
if: ${{ matrix.toolchain == 'msvc' }}
|
||||||
|
uses: ilammy/msvc-dev-cmd@v1
|
||||||
|
|
||||||
|
- uses: luarocks/gh-actions-lua@master
|
||||||
|
with:
|
||||||
|
luaVersion: ${{ matrix.lua-version }}
|
||||||
|
|
||||||
|
- uses: luarocks/gh-actions-luarocks@master
|
||||||
|
|
||||||
|
- name: Prep luacov
|
||||||
|
run: |
|
||||||
|
luarocks install luacov
|
||||||
|
|
||||||
|
- name: Prep luacov-coveralls
|
||||||
|
# TODO Windows coverage
|
||||||
|
if: ${{ matrix.os != 'windows-latest' }}
|
||||||
|
run: |
|
||||||
|
pip install --user cpp-coveralls
|
||||||
|
# install luacov-coveralls, but avoid installing luafilesystem
|
||||||
|
luarocks install lua-path
|
||||||
|
luarocks install dkjson
|
||||||
|
luarocks install luacov-coveralls --server=https://luarocks.org/dev --deps-mode=none
|
||||||
|
|
||||||
|
- name: Unix Build
|
||||||
|
if: ${{ matrix.os != 'windows-latest' }}
|
||||||
|
run: |
|
||||||
|
luarocks make CFLAGS="-O2 -fPIC -ftest-coverage -fprofile-arcs" LIBFLAG="${{ matrix.libflag }}"
|
||||||
|
|
||||||
|
- name: Windows Build
|
||||||
|
# TODO Windows coverage
|
||||||
|
if: ${{ matrix.os == 'windows-latest' }}
|
||||||
|
run: |
|
||||||
|
luarocks make
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
run: |
|
||||||
|
lua -lluacov tests/test.lua
|
||||||
|
|
||||||
|
- name: Coverage
|
||||||
|
# TODO Windows coverage
|
||||||
|
if: ${{ matrix.os != 'windows-latest' }}
|
||||||
|
run: |
|
||||||
|
export MY_PYTHON_VER=$(python -c 'import sys; print(".".join(sys.version.split(".")[0:2]))')
|
||||||
|
export PATH="/Users/runner/Library/Python/$MY_PYTHON_VER/bin:$PATH"
|
||||||
|
coveralls -b . -i src --dump c.report.json
|
||||||
|
luacov-coveralls -j c.report.json -v -t ${{ secrets.GITHUB_TOKEN }}
|
||||||
35
.travis.yml
35
.travis.yml
@@ -1,35 +0,0 @@
|
|||||||
language: c
|
|
||||||
|
|
||||||
sudo: false
|
|
||||||
|
|
||||||
env:
|
|
||||||
- LUA="lua 5.1"
|
|
||||||
- LUA="lua 5.2"
|
|
||||||
- LUA="lua 5.3"
|
|
||||||
- LUA="luajit 2.0"
|
|
||||||
|
|
||||||
before_install:
|
|
||||||
- pip install --user cpp-coveralls hererocks
|
|
||||||
- hererocks env --$LUA --luarocks latest
|
|
||||||
- export PATH="$PWD/env/bin:$PATH"
|
|
||||||
- luarocks install Lua-cURL --server=https://luarocks.org/dev
|
|
||||||
- luarocks install lua-path
|
|
||||||
- luarocks install lua-cjson
|
|
||||||
- luarocks install luacov
|
|
||||||
# install luacov-coveralls, but avoids installing luafilesystem
|
|
||||||
- luarocks install luacov-coveralls --server=https://luarocks.org/dev --deps-mode=none
|
|
||||||
|
|
||||||
install:
|
|
||||||
- luarocks make rockspecs/luafilesystem-cvs-3.rockspec CFLAGS="-O2 -fPIC -ftest-coverage -fprofile-arcs" LIBFLAG="-shared --coverage"
|
|
||||||
|
|
||||||
script:
|
|
||||||
- lua -lluacov tests/test.lua
|
|
||||||
|
|
||||||
after_success:
|
|
||||||
- coveralls -b . -i src --dump c.report.json
|
|
||||||
- luacov-coveralls -j c.report.json -v
|
|
||||||
|
|
||||||
notifications:
|
|
||||||
email:
|
|
||||||
on_success: change
|
|
||||||
on_failure: always
|
|
||||||
3
LICENSE
3
LICENSE
@@ -1,4 +1,5 @@
|
|||||||
Copyright © 2003-2014 Kepler Project.
|
Copyright © 2003-2010 Kepler Project.
|
||||||
|
Copyright © 2010-2022 The LuaFileSystem authors.
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person
|
Permission is hereby granted, free of charge, to any person
|
||||||
obtaining a copy of this software and associated documentation
|
obtaining a copy of this software and associated documentation
|
||||||
|
|||||||
6
Makefile
6
Makefile
@@ -12,14 +12,14 @@ OBJS= src/$T.o
|
|||||||
lib: src/lfs.so
|
lib: src/lfs.so
|
||||||
|
|
||||||
src/lfs.so: $(OBJS)
|
src/lfs.so: $(OBJS)
|
||||||
MACOSX_DEPLOYMENT_TARGET="10.3"; export MACOSX_DEPLOYMENT_TARGET; $(CC) $(LIB_OPTION) -o src/lfs.so $(OBJS)
|
MACOSX_DEPLOYMENT_TARGET=$(MACOSX_DEPLOYMENT_TARGET); export MACOSX_DEPLOYMENT_TARGET; $(CC) $(LIB_OPTION) -o src/lfs.so $(OBJS)
|
||||||
|
|
||||||
test: lib
|
test: lib
|
||||||
LUA_CPATH=./src/?.so lua tests/test.lua
|
LUA_CPATH=./src/?.so lua tests/test.lua
|
||||||
|
|
||||||
install:
|
install:
|
||||||
mkdir -p $(LUA_LIBDIR)
|
mkdir -p $(DESTDIR)$(LUA_LIBDIR)
|
||||||
cp src/lfs.so $(LUA_LIBDIR)
|
cp src/lfs.so $(DESTDIR)$(LUA_LIBDIR)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f src/lfs.so $(OBJS)
|
rm -f src/lfs.so $(OBJS)
|
||||||
|
|||||||
13
README.md
13
README.md
@@ -1,12 +1,11 @@
|
|||||||
[](LICENCE.txt)
|
[](LICENSE)
|
||||||
[](https://travis-ci.org/keplerproject/luafilesystem)
|
[](https://github.com/lunarmodules/luafilesystem/actions)
|
||||||
[](https://ci.appveyor.com/project/ignacio/luafilesystem)
|
[](https://ci.appveyor.com/project/ignacio/luafilesystem)
|
||||||
[](https://coveralls.io/r/keplerproject/luafilesystem)
|
[](https://coveralls.io/r/lunarmodules/luafilesystem)
|
||||||
|
|
||||||
# LuaFileSystem - File System Library for Lua
|
# LuaFileSystem - File System Library for Lua
|
||||||
Copyright 2003-2016 Kepler Project
|
|
||||||
|
|
||||||
http://keplerproject.github.io/luafilesystem
|
https://lunarmodules.github.io/luafilesystem
|
||||||
|
|
||||||
# Description
|
# Description
|
||||||
|
|
||||||
@@ -14,7 +13,7 @@ LuaFileSystem is a Lua library developed to complement the set of functions
|
|||||||
related to file systems offered by the standard Lua distribution.
|
related to file systems offered by the standard Lua distribution.
|
||||||
|
|
||||||
LuaFileSystem offers a portable way to access the underlying directory structure and file attributes.
|
LuaFileSystem offers a portable way to access the underlying directory structure and file attributes.
|
||||||
LuaFileSystem is free software and uses the same license as Lua 5.1
|
LuaFileSystem is free software and uses the same license as Lua 5.x (MIT).
|
||||||
|
|
||||||
# LuaRocks Installation
|
# LuaRocks Installation
|
||||||
|
|
||||||
@@ -24,4 +23,4 @@ luarocks install luafilesystem
|
|||||||
|
|
||||||
# Documentation
|
# Documentation
|
||||||
|
|
||||||
Please check the documentation at doc/us/ for more information.
|
Please check the at `docs/` for more information, also available at the [project website](https://lunarmodules.github.io/luafilesystem).
|
||||||
|
|||||||
49
appveyor.yml
49
appveyor.yml
@@ -1,18 +1,25 @@
|
|||||||
version: 0.0.1.{build}-test
|
version: 0.0.1.{build}-test
|
||||||
|
|
||||||
# Use default image unless needed
|
|
||||||
#os:
|
|
||||||
#- Windows Server 2012 R2
|
|
||||||
|
|
||||||
shallow_clone: true
|
shallow_clone: true
|
||||||
|
|
||||||
|
matrix:
|
||||||
|
fast_finish: true
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
matrix:
|
matrix:
|
||||||
- LUA: "lua 5.1"
|
- LUAT: "lua"
|
||||||
- LUA: "lua 5.2 --compat none"
|
LUAV: "5.1"
|
||||||
- LUA: "lua 5.3 --compat none"
|
- LUAT: "lua"
|
||||||
- LUA: "luajit 2.0"
|
LUAV: "5.2"
|
||||||
- LUA: "luajit 2.1"
|
HEREROCKS_FLAGS: "--compat none"
|
||||||
|
- LUAT: "lua"
|
||||||
|
LUAV: "5.3"
|
||||||
|
HEREROCKS_FLAGS: "--compat none"
|
||||||
|
- LUAT: "lua"
|
||||||
|
LUAV: "5.4"
|
||||||
|
HEREROCKS_FLAGS: "--compat none"
|
||||||
|
- LUAT: "luajit"
|
||||||
|
LUAV: "2.1"
|
||||||
|
|
||||||
# Abuse this section so we can have a matrix with different Compiler versions
|
# Abuse this section so we can have a matrix with different Compiler versions
|
||||||
configuration:
|
configuration:
|
||||||
@@ -20,17 +27,17 @@ configuration:
|
|||||||
- vs_32
|
- vs_32
|
||||||
- vs_64
|
- vs_64
|
||||||
|
|
||||||
install:
|
|
||||||
- set PATH=%CD%\env\bin;C:\Python27\Scripts;C:\MinGW\bin;%PATH%
|
|
||||||
- pip install hererocks
|
|
||||||
- hererocks env --%LUA% --target %configuration% --luarocks latest
|
|
||||||
|
|
||||||
before_build:
|
before_build:
|
||||||
# @todo
|
- set PATH=C:\MinGW\bin;%PATH%
|
||||||
- echo "Installing external deps"
|
- set PATH=C:\Python37;C:\Python37\Scripts;%PATH% # Add directory containing 'pip' to PATH
|
||||||
|
- IF NOT EXIST lua_install-%LUAV%\bin\activate.bat ( pip install --upgrade certifi )
|
||||||
|
- FOR /F "tokens=* USEBACKQ" %%F IN (`python -c "import certifi;print(certifi.where())"`) DO ( SET SSL_CERT_FILE=%%F )
|
||||||
|
- IF NOT EXIST lua_install-%LUAV%\bin\activate.bat ( pip install hererocks )
|
||||||
|
- IF NOT EXIST lua_install-%LUAV%\bin\activate.bat ( hererocks lua_install-%LUAV% --%LUAT% %LUAV% %HEREROCKS_FLAGS% --luarocks latest --target=%configuration% )
|
||||||
|
- call lua_install-%LUAV%\bin\activate
|
||||||
|
|
||||||
build_script:
|
build_script:
|
||||||
- luarocks make rockspecs/luafilesystem-cvs-3.rockspec
|
- luarocks make
|
||||||
|
|
||||||
before_test:
|
before_test:
|
||||||
|
|
||||||
@@ -38,5 +45,9 @@ test_script:
|
|||||||
- echo "Testing..."
|
- echo "Testing..."
|
||||||
- lua tests/test.lua
|
- lua tests/test.lua
|
||||||
|
|
||||||
after_test:
|
cache:
|
||||||
# @todo
|
- lua_install-5.4
|
||||||
|
- lua_install-5.3
|
||||||
|
- lua_install-5.2
|
||||||
|
- lua_install-5.1
|
||||||
|
- lua_install-2.1
|
||||||
|
|||||||
12
config
12
config
@@ -3,21 +3,25 @@
|
|||||||
# Default installation prefix
|
# Default installation prefix
|
||||||
PREFIX=/usr/local
|
PREFIX=/usr/local
|
||||||
|
|
||||||
|
LUA_VERSION = 5.1
|
||||||
|
|
||||||
# System's libraries directory (where binary libraries are installed)
|
# System's libraries directory (where binary libraries are installed)
|
||||||
LUA_LIBDIR= $(PREFIX)/lib/lua/5.1
|
LUA_LIBDIR= $(PREFIX)/lib/lua/$(LUA_VERSION)
|
||||||
|
|
||||||
# Lua includes directory
|
# Lua includes directory
|
||||||
LUA_INC= $(PREFIX)/include
|
LUA_INC += -I$(PREFIX)/include
|
||||||
|
LUA_INC += -I/usr/include/lua$(LUA_VERSION) -I/usr/include/lua/$(LUA_VERSION)
|
||||||
|
|
||||||
# OS dependent
|
# OS dependent
|
||||||
LIB_OPTION= -shared #for Linux
|
LIB_OPTION= -shared #for Linux
|
||||||
#LIB_OPTION= -bundle -undefined dynamic_lookup #for MacOS X
|
#LIB_OPTION= -bundle -undefined dynamic_lookup #for MacOS X
|
||||||
|
|
||||||
LIBNAME= $T.so.$V
|
# Minimum runtime OS version on macOS
|
||||||
|
MACOSX_DEPLOYMENT_TARGET= 10.5
|
||||||
|
|
||||||
# Compilation directives
|
# Compilation directives
|
||||||
WARN= -O2 -Wall -fPIC -W -Waggregate-return -Wcast-align -Wmissing-prototypes -Wnested-externs -Wshadow -Wwrite-strings -pedantic
|
WARN= -O2 -Wall -fPIC -W -Waggregate-return -Wcast-align -Wmissing-prototypes -Wnested-externs -Wshadow -Wwrite-strings -pedantic
|
||||||
INCS= -I$(LUA_INC)
|
INCS= $(LUA_INC)
|
||||||
CFLAGS= $(WARN) $(INCS)
|
CFLAGS= $(WARN) $(INCS)
|
||||||
CC= gcc
|
CC= gcc
|
||||||
|
|
||||||
|
|||||||
10
config.win
10
config.win
@@ -1,14 +1,14 @@
|
|||||||
|
LUA_VERSION= 5.1
|
||||||
|
|
||||||
# Installation directories
|
# Installation directories
|
||||||
# System's libraries directory (where binary libraries are installed)
|
# System's libraries directory (where binary libraries are installed)
|
||||||
LUA_LIBDIR= "c:\lua5.1"
|
LUA_LIBDIR= "c:\lua$(LUA_VERSION)"
|
||||||
|
|
||||||
# Lua includes directory
|
# Lua includes directory
|
||||||
LUA_INC= "c:\lua5.1\include"
|
LUA_INC= "c:\lua$(LUA_VERSION)\include"
|
||||||
|
|
||||||
# Lua library
|
# Lua library
|
||||||
LUA_LIB= "c:\lua5.1\lua5.1.lib"
|
LUA_LIB= "c:\lua$(LUA_VERSION)\lua$(LUA_VERSION).lib"
|
||||||
|
|
||||||
LIBNAME= $T.dll
|
|
||||||
|
|
||||||
# Compilation directives
|
# Compilation directives
|
||||||
WARN= /O2
|
WARN= /O2
|
||||||
|
|||||||
212
doc/us/doc.css
212
doc/us/doc.css
@@ -1,212 +0,0 @@
|
|||||||
body {
|
|
||||||
margin-left: 1em;
|
|
||||||
margin-right: 1em;
|
|
||||||
font-family: arial, helvetica, geneva, sans-serif;
|
|
||||||
background-color:#ffffff; margin:0px;
|
|
||||||
}
|
|
||||||
|
|
||||||
code {
|
|
||||||
font-family: "Andale Mono", monospace;
|
|
||||||
}
|
|
||||||
|
|
||||||
tt {
|
|
||||||
font-family: "Andale Mono", monospace;
|
|
||||||
}
|
|
||||||
|
|
||||||
body, td, th { font-size: 11pt; }
|
|
||||||
|
|
||||||
h1, h2, h3, h4 { margin-left: 0em; }
|
|
||||||
|
|
||||||
textarea, pre, tt { font-size:10pt; }
|
|
||||||
body, td, th { color:#000000; }
|
|
||||||
small { font-size:0.85em; }
|
|
||||||
h1 { font-size:1.5em; }
|
|
||||||
h2 { font-size:1.25em; }
|
|
||||||
h3 { font-size:1.15em; }
|
|
||||||
h4 { font-size:1.06em; }
|
|
||||||
|
|
||||||
a:link { font-weight:bold; color: #004080; text-decoration: none; }
|
|
||||||
a:visited { font-weight:bold; color: #006699; text-decoration: none; }
|
|
||||||
a:link:hover { text-decoration:underline; }
|
|
||||||
hr { color:#cccccc }
|
|
||||||
img { border-width: 0px; }
|
|
||||||
|
|
||||||
h3 { padding-top: 1em; }
|
|
||||||
|
|
||||||
p { margin-left: 1em; }
|
|
||||||
|
|
||||||
p.name {
|
|
||||||
font-family: "Andale Mono", monospace;
|
|
||||||
padding-top: 1em;
|
|
||||||
margin-left: 0em;
|
|
||||||
}
|
|
||||||
|
|
||||||
blockquote { margin-left: 3em; }
|
|
||||||
|
|
||||||
.example {
|
|
||||||
background-color: rgb(245, 245, 245);
|
|
||||||
border-top-width: 1px;
|
|
||||||
border-right-width: 1px;
|
|
||||||
border-bottom-width: 1px;
|
|
||||||
border-left-width: 1px;
|
|
||||||
border-top-style: solid;
|
|
||||||
border-right-style: solid;
|
|
||||||
border-bottom-style: solid;
|
|
||||||
border-left-style: solid;
|
|
||||||
border-top-color: silver;
|
|
||||||
border-right-color: silver;
|
|
||||||
border-bottom-color: silver;
|
|
||||||
border-left-color: silver;
|
|
||||||
padding: 1em;
|
|
||||||
margin-left: 1em;
|
|
||||||
margin-right: 1em;
|
|
||||||
font-family: "Andale Mono", monospace;
|
|
||||||
font-size: smaller;
|
|
||||||
}
|
|
||||||
|
|
||||||
hr {
|
|
||||||
margin-left: 0em;
|
|
||||||
background: #00007f;
|
|
||||||
border: 0px;
|
|
||||||
height: 1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
ul { list-style-type: disc; }
|
|
||||||
|
|
||||||
table.index { border: 1px #00007f; }
|
|
||||||
table.index td { text-align: left; vertical-align: top; }
|
|
||||||
table.index ul { padding-top: 0em; margin-top: 0em; }
|
|
||||||
|
|
||||||
table {
|
|
||||||
border: 1px solid black;
|
|
||||||
border-collapse: collapse;
|
|
||||||
margin-left: auto;
|
|
||||||
margin-right: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
th {
|
|
||||||
border: 1px solid black;
|
|
||||||
padding: 0.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
td {
|
|
||||||
border: 1px solid black;
|
|
||||||
padding: 0.5em;
|
|
||||||
}
|
|
||||||
div.header, div.footer { margin-left: 0em; }
|
|
||||||
|
|
||||||
#container {
|
|
||||||
margin-left: 1em;
|
|
||||||
margin-right: 1em;
|
|
||||||
background-color: #f0f0f0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#product {
|
|
||||||
text-align: center;
|
|
||||||
border-bottom: 1px solid #cccccc;
|
|
||||||
background-color: #ffffff;
|
|
||||||
}
|
|
||||||
|
|
||||||
#product big {
|
|
||||||
font-size: 2em;
|
|
||||||
}
|
|
||||||
|
|
||||||
#product_logo {
|
|
||||||
}
|
|
||||||
|
|
||||||
#product_name {
|
|
||||||
}
|
|
||||||
|
|
||||||
#product_description {
|
|
||||||
}
|
|
||||||
|
|
||||||
#main {
|
|
||||||
background-color: #f0f0f0;
|
|
||||||
border-left: 2px solid #cccccc;
|
|
||||||
}
|
|
||||||
|
|
||||||
#navigation {
|
|
||||||
float: left;
|
|
||||||
width: 12em;
|
|
||||||
margin: 0;
|
|
||||||
vertical-align: top;
|
|
||||||
background-color: #f0f0f0;
|
|
||||||
overflow:visible;
|
|
||||||
}
|
|
||||||
|
|
||||||
#navigation h1 {
|
|
||||||
background-color:#e7e7e7;
|
|
||||||
font-size:1.1em;
|
|
||||||
color:#000000;
|
|
||||||
text-align:left;
|
|
||||||
margin:0px;
|
|
||||||
padding:0.2em;
|
|
||||||
border-top:1px solid #dddddd;
|
|
||||||
border-bottom:1px solid #dddddd;
|
|
||||||
}
|
|
||||||
|
|
||||||
#navigation ul {
|
|
||||||
font-size:1em;
|
|
||||||
list-style-type: none;
|
|
||||||
padding: 0;
|
|
||||||
margin: 1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#navigation li {
|
|
||||||
text-indent: -1em;
|
|
||||||
margin: 0em 0em 0em 0.5em;
|
|
||||||
display: block;
|
|
||||||
padding: 3px 0px 0px 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#navigation li li a {
|
|
||||||
padding: 0px 3px 0px -1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
#content {
|
|
||||||
margin-left: 12em;
|
|
||||||
padding: 1em;
|
|
||||||
border-left: 2px solid #cccccc;
|
|
||||||
border-right: 2px solid #cccccc;
|
|
||||||
background-color: #ffffff;
|
|
||||||
}
|
|
||||||
|
|
||||||
#about {
|
|
||||||
clear: both;
|
|
||||||
margin: 0;
|
|
||||||
padding: 5px;
|
|
||||||
border-top: 2px solid #cccccc;
|
|
||||||
background-color: #ffffff;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media print {
|
|
||||||
body {
|
|
||||||
font: 10pt "Times New Roman", "TimeNR", Times, serif;
|
|
||||||
}
|
|
||||||
a {
|
|
||||||
font-weight:bold; color: #004080; text-decoration: underline;
|
|
||||||
}
|
|
||||||
#main {
|
|
||||||
background-color: #ffffff; border-left: 0px;
|
|
||||||
}
|
|
||||||
#container {
|
|
||||||
margin-left: 2%; margin-right: 2%; background-color: #ffffff;
|
|
||||||
}
|
|
||||||
#content {
|
|
||||||
margin-left: 0px; padding: 1em; border-left: 0px; border-right: 0px; background-color: #ffffff;
|
|
||||||
}
|
|
||||||
#navigation {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
#product_logo {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
#about img {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
.example {
|
|
||||||
font-family: "Andale Mono", monospace;
|
|
||||||
font-size: 8pt;
|
|
||||||
page-break-inside: avoid;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
209
docs/doc.css
Normal file
209
docs/doc.css
Normal file
@@ -0,0 +1,209 @@
|
|||||||
|
body {
|
||||||
|
color: #47555c;
|
||||||
|
font-size: 16px;
|
||||||
|
font-family: "Open Sans", sans-serif;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
background: #eff4ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:link { color: #008fee; }
|
||||||
|
a:visited { color: #008fee; }
|
||||||
|
a:hover { color: #22a7ff; }
|
||||||
|
|
||||||
|
h1 { font-size:26px; }
|
||||||
|
h2 { font-size:24px; }
|
||||||
|
h3 { font-size:18px; }
|
||||||
|
h4 { font-size:16px; }
|
||||||
|
|
||||||
|
hr {
|
||||||
|
height: 1px;
|
||||||
|
background: #c1cce4;
|
||||||
|
border: 0px;
|
||||||
|
margin: 20px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
code {
|
||||||
|
font-family: "Open Sans Mono", "Andale Mono", monospace;
|
||||||
|
}
|
||||||
|
|
||||||
|
tt {
|
||||||
|
font-family: "Open Sans Mono", "Andale Mono", monospace;
|
||||||
|
}
|
||||||
|
|
||||||
|
body, td, th {
|
||||||
|
}
|
||||||
|
|
||||||
|
textarea, pre, tt {
|
||||||
|
font-family: "Open Sans Mono", "Andale Mono", monospace;
|
||||||
|
}
|
||||||
|
|
||||||
|
img {
|
||||||
|
border-width: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.example {
|
||||||
|
background-color: #323744;
|
||||||
|
color: white;
|
||||||
|
font-size: 16px;
|
||||||
|
padding: 16px 24px;
|
||||||
|
border-radius: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.header, div.footer {
|
||||||
|
}
|
||||||
|
|
||||||
|
#container {
|
||||||
|
}
|
||||||
|
|
||||||
|
#product {
|
||||||
|
background-color: white;
|
||||||
|
padding: 10px;
|
||||||
|
height: 130px;
|
||||||
|
border-bottom: solid #d3dbec 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#product big {
|
||||||
|
font-size: 42px;
|
||||||
|
}
|
||||||
|
#product strong {
|
||||||
|
font-weight: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
#product_logo {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
#product_name {
|
||||||
|
padding-top: 15px;
|
||||||
|
padding-left: 30px;
|
||||||
|
font-size: 42px;
|
||||||
|
font-weight: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
#product_description {
|
||||||
|
padding-left: 30px;
|
||||||
|
color: #757779;
|
||||||
|
}
|
||||||
|
|
||||||
|
#main {
|
||||||
|
background: #eff4ff;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#navigation {
|
||||||
|
width: 100%;
|
||||||
|
background-color: rgb(44,62,103);
|
||||||
|
padding: 10px;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#navigation h1 {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#navigation a:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
#navigation ul li a {
|
||||||
|
color: rgb(136, 208, 255);
|
||||||
|
font-weight: bold;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#navigation ul li li a {
|
||||||
|
color: rgb(136, 208, 255);
|
||||||
|
font-weight: normal;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#navigation ul {
|
||||||
|
display: inline;
|
||||||
|
color: white;
|
||||||
|
padding: 0px;
|
||||||
|
padding-top: 10px;
|
||||||
|
padding-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#navigation li {
|
||||||
|
display: inline;
|
||||||
|
list-style-type: none;
|
||||||
|
padding-left: 5px;
|
||||||
|
padding-right: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#navigation li {
|
||||||
|
padding: 10px;
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#navigation li li {
|
||||||
|
}
|
||||||
|
|
||||||
|
#navigation li:hover a {
|
||||||
|
color: rgb(166, 238, 255);
|
||||||
|
}
|
||||||
|
|
||||||
|
#content {
|
||||||
|
padding: 20px;
|
||||||
|
width: 800px;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
#about {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
dl.reference {
|
||||||
|
background-color: white;
|
||||||
|
padding: 20px;
|
||||||
|
border: solid #d3dbec 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
dl.reference dt {
|
||||||
|
padding: 5px;
|
||||||
|
padding-top: 25px;
|
||||||
|
color: #637bbc;
|
||||||
|
}
|
||||||
|
|
||||||
|
dl.reference dl dt {
|
||||||
|
padding-top: 5px;
|
||||||
|
color: #637383;
|
||||||
|
}
|
||||||
|
|
||||||
|
dl.reference dd {
|
||||||
|
}
|
||||||
|
|
||||||
|
@media print {
|
||||||
|
body {
|
||||||
|
font: 10pt "Times New Roman", "TimeNR", Times, serif;
|
||||||
|
}
|
||||||
|
a {
|
||||||
|
font-weight:bold; color: #004080; text-decoration: underline;
|
||||||
|
}
|
||||||
|
#main {
|
||||||
|
background-color: #ffffff; border-left: 0px;
|
||||||
|
}
|
||||||
|
#container {
|
||||||
|
margin-left: 2%; margin-right: 2%; background-color: #ffffff;
|
||||||
|
}
|
||||||
|
#content {
|
||||||
|
margin-left: 0px; padding: 1em; border-left: 0px; border-right: 0px; background-color: #ffffff;
|
||||||
|
}
|
||||||
|
#navigation {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
#product_logo {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
#about img {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.example {
|
||||||
|
font-family: "Andale Mono", monospace;
|
||||||
|
font-size: 8pt;
|
||||||
|
page-break-inside: avoid;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
<div id="product">
|
<div id="product">
|
||||||
<div id="product_logo">
|
<div id="product_logo">
|
||||||
<a href="http://keplerproject.github.io/luafilesystem">
|
<a href="http://lunarmodules.github.io/luafilesystem">
|
||||||
<img alt="LuaFileSystem" src="luafilesystem.png"/>
|
<img alt="LuaFileSystem" src="luafilesystem.png"/>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
@@ -44,10 +44,10 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li><strong>Examples</strong></li>
|
<li><strong>Examples</strong></li>
|
||||||
<li><a href="https://github.com/keplerproject/luafilesystem">Project</a>
|
<li><a href="https://github.com/lunarmodules/luafilesystem">Project</a>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="https://github.com/keplerproject/luafilesystem/issues">Bug Tracker</a></li>
|
<li><a href="https://github.com/lunarmodules/luafilesystem/issues">Bug Tracker</a></li>
|
||||||
<li><a href="https://github.com/keplerproject/luafilesystem">Git</a></li>
|
<li><a href="https://github.com/lunarmodules/luafilesystem">Git</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="license.html">License</a></li>
|
<li><a href="license.html">License</a></li>
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
<div id="product">
|
<div id="product">
|
||||||
<div id="product_logo">
|
<div id="product_logo">
|
||||||
<a href="http://keplerproject.github.io/luafilesystem">
|
<a href="http://lunarmodules.github.io/luafilesystem">
|
||||||
<img alt="LuaFileSystem" src="luafilesystem.png"/>
|
<img alt="LuaFileSystem" src="luafilesystem.png"/>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
@@ -44,10 +44,10 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="examples.html">Examples</a></li>
|
<li><a href="examples.html">Examples</a></li>
|
||||||
<li><a href="https://github.com/keplerproject/luafilesystem">Project</a>
|
<li><a href="https://github.com/lunarmodules/luafilesystem">Project</a>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="https://github.com/keplerproject/luafilesystem/issues">Bug Tracker</a></li>
|
<li><a href="https://github.com/lunarmodules/luafilesystem/issues">Bug Tracker</a></li>
|
||||||
<li><a href="https://github.com/keplerproject/luafilesystem">Git</a></li>
|
<li><a href="https://github.com/lunarmodules/luafilesystem">Git</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="license.html">License</a></li>
|
<li><a href="license.html">License</a></li>
|
||||||
@@ -70,17 +70,46 @@ the underlying directory structure and file attributes.</p>
|
|||||||
|
|
||||||
<h2><a name="status"></a>Status</h2>
|
<h2><a name="status"></a>Status</h2>
|
||||||
|
|
||||||
<p>Current version is 1.6.3. It works with Lua 5.1, 5.2 and 5.3.</p>
|
<p>Current version is 1.9.0. It works with Lua 5.1 to Lua 5.5, and it runs on various
|
||||||
|
flavors of Unix (including Linux, BSDs, macOS) and Windows.</p>
|
||||||
|
|
||||||
<h2><a name="download"></a>Download</h2>
|
<h2><a name="download"></a>Download</h2>
|
||||||
|
|
||||||
<p>LuaFileSystem source can be downloaded from its
|
<p>LuaFileSystem can be installed using <a href="https://luarocks.org">LuaRocks</a>:
|
||||||
<a href="http://github.com/keplerproject/luafilesystem">Github</a>
|
|
||||||
page.</p>
|
<pre class="example">
|
||||||
|
$ luarocks install luafilesystem
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
<p>Its source can be found at its <a href="http://github.com/lunarmodules/luafilesystem">GitHub</a> page.</p>
|
||||||
|
|
||||||
<h2><a name="history"></a>History</h2>
|
<h2><a name="history"></a>History</h2>
|
||||||
|
|
||||||
<dl class="history">
|
<dl class="history">
|
||||||
|
<dt><strong>Version 1.9.0</strong> [28/Dec/2025]</dt>
|
||||||
|
<dd><ul>
|
||||||
|
<li>Lua 5.5 support</li>
|
||||||
|
<li>Fixed some compiler warnings</li>
|
||||||
|
<li>Assorted improvements for Windows</li>
|
||||||
|
</ul></dd>
|
||||||
|
|
||||||
|
<dt><strong>Version 1.8.0</strong> [22/Apr/2020]</dt>
|
||||||
|
<dd><ul>
|
||||||
|
<li>Lua 5.4 support</li>
|
||||||
|
<li>lfs.link and lfs.symlinkattributes now work on Windows</li>
|
||||||
|
<li>MACOSX_DEPLOYMENT_TARGET is configurable in the Makefile</li>
|
||||||
|
<li>Fallback to _POSIX_PATH_MAX when MAXPATHLEN is not avaliable</li>
|
||||||
|
<li>Fixed memory leak in case of realloc failure</li>
|
||||||
|
</ul></dd>
|
||||||
|
|
||||||
|
<dt><strong>Version 1.7.0</strong> [15/Sep/2017]</dt>
|
||||||
|
<dd><ul>
|
||||||
|
<li>symlinkattributes function now provides 'target' field, containing name of the file that the symlink points to.</li>
|
||||||
|
<li>attributes, symlinkattributes, touch, mkdir, and rmdir functions now return system-dependent error code as the third value on error.</li>
|
||||||
|
<li>Fixed detection of closed files for Lua 5.2+ in setmode, lock, and unlock functions.</li>
|
||||||
|
<li>Fixed various compiler warnings.</li>
|
||||||
|
</ul></dd>
|
||||||
|
|
||||||
<dt><strong>Version 1.6.3</strong> [15/Jan/2015]</dt>
|
<dt><strong>Version 1.6.3</strong> [15/Jan/2015]</dt>
|
||||||
<dd><ul>
|
<dd><ul>
|
||||||
<li>Lua 5.3 support.</li>
|
<li>Lua 5.3 support.</li>
|
||||||
@@ -188,10 +217,11 @@ page.</p>
|
|||||||
|
|
||||||
<h2><a name="credits"></a>Credits</h2>
|
<h2><a name="credits"></a>Credits</h2>
|
||||||
|
|
||||||
<p>LuaFileSystem was designed by Roberto Ierusalimschy,
|
<p>The LuaFileSystem library was originally designed and
|
||||||
André Carregal and Tomás Guisasola as part of the
|
implemented by Roberto Ierusalimschy, André Carregal and
|
||||||
<a href="https://github.com/keplerproject">Kepler Project</a>,
|
Tomás Guisasola. It was then maintained by Fábio
|
||||||
which holds its copyright. LuaFileSystem is currently maintained by Fábio Mascarenhas.</p>
|
Mascarenhas for several years and has since been maintained
|
||||||
|
by many contributors -- see the Git history for detailed credits.</p>
|
||||||
|
|
||||||
</div> <!-- id="content" -->
|
</div> <!-- id="content" -->
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
<div id="product">
|
<div id="product">
|
||||||
<div id="product_logo">
|
<div id="product_logo">
|
||||||
<a href="http://keplerproject.github.io/luafilesystem">
|
<a href="http://lunarmodules.github.io/luafilesystem">
|
||||||
<img alt="LuaFileSystem" src="luafilesystem.png"/>
|
<img alt="LuaFileSystem" src="luafilesystem.png"/>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
@@ -44,10 +44,10 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="examples.html">Examples</a></li>
|
<li><a href="examples.html">Examples</a></li>
|
||||||
<li><a href="https://github.com/keplerproject/luafilesystem">Project</a>
|
<li><a href="https://github.com/lunarmodules/luafilesystem">Project</a>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="https://github.com/keplerproject/luafilesystem/issues">Bug Tracker</a></li>
|
<li><a href="https://github.com/lunarmodules/luafilesystem/issues">Bug Tracker</a></li>
|
||||||
<li><a href="https://github.com/keplerproject/luafilesystem">Git</a></li>
|
<li><a href="https://github.com/lunarmodules/luafilesystem">Git</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li><strong>License</strong></li>
|
<li><strong>License</strong></li>
|
||||||
@@ -58,33 +58,21 @@
|
|||||||
|
|
||||||
<h1>License</h1>
|
<h1>License</h1>
|
||||||
|
|
||||||
<p>
|
|
||||||
LuaFileSystem is free software: it can be used for both academic
|
|
||||||
and commercial purposes at absolutely no cost. There are no
|
|
||||||
royalties or GNU-like "copyleft" restrictions. LuaFileSystem
|
|
||||||
qualifies as
|
|
||||||
<a href="http://www.opensource.org/docs/definition.html">Open Source</a>
|
|
||||||
software.
|
|
||||||
Its licenses are compatible with
|
|
||||||
<a href="http://www.gnu.org/licenses/gpl.html">GPL</a>.
|
|
||||||
LuaFileSystem is not in the public domain and the
|
|
||||||
<a href="https://github.com/keplerproject">Kepler Project</a>
|
|
||||||
keep its copyright.
|
|
||||||
The legal details are below.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>The spirit of the license is that you are free to use
|
<p>The spirit of the license is that you are free to use
|
||||||
LuaFileSystem for any purpose at no cost without having to ask us.
|
LuaFileSystem for any purpose at no cost without having to ask us.
|
||||||
The only requirement is that if you do use LuaFileSystem, then you
|
The only requirement is that if you do use LuaFileSystem, then you
|
||||||
should give us credit by including the appropriate copyright notice
|
should give us credit by including the appropriate copyright notice
|
||||||
somewhere in your product or its documentation.</p>
|
somewhere in your product or its documentation.</p>
|
||||||
|
|
||||||
<p>The LuaFileSystem library is designed and implemented by Roberto
|
<p>The LuaFileSystem library was originally designed and
|
||||||
Ierusalimschy, André Carregal and Tomás Guisasola.
|
implemented by Roberto Ierusalimschy, André Carregal and
|
||||||
The implementation is not derived from licensed software.</p>
|
Tomás Guisasola, and has since been maintained over the years
|
||||||
|
by many people -- see the Git history for detailed credits.
|
||||||
|
The implementation is not derived from any other licensed software.</p>
|
||||||
|
|
||||||
<hr/>
|
<hr/>
|
||||||
<p>Copyright © 2003 Kepler Project.</p>
|
<p>Copyright © 2003 - 2010 Kepler Project.</p>
|
||||||
|
<p>Copyright © 2010 - 2022 The LuaFileSystem authors.</p>
|
||||||
|
|
||||||
<p>Permission is hereby granted, free of charge, to any person
|
<p>Permission is hereby granted, free of charge, to any person
|
||||||
obtaining a copy of this software and associated documentation
|
obtaining a copy of this software and associated documentation
|
||||||
|
Before Width: | Height: | Size: 8.3 KiB After Width: | Height: | Size: 8.3 KiB |
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
<div id="product">
|
<div id="product">
|
||||||
<div id="product_logo">
|
<div id="product_logo">
|
||||||
<a href="http://keplerproject.github.io/luafilesystem">
|
<a href="http://lunarmodules.github.io/luafilesystem">
|
||||||
<img alt="LuaFileSystem" src="luafilesystem.png"/>
|
<img alt="LuaFileSystem" src="luafilesystem.png"/>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
@@ -44,10 +44,10 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="examples.html">Examples</a></li>
|
<li><a href="examples.html">Examples</a></li>
|
||||||
<li><a href="https://github.com/keplerproject/luafilesystem">Project</a>
|
<li><a href="https://github.com/lunarmodules/luafilesystem">Project</a>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="https://github.com/keplerproject/luafilesystem/issues">Bug Tracker</a></li>
|
<li><a href="https://github.com/lunarmodules/luafilesystem/issues">Bug Tracker</a></li>
|
||||||
<li><a href="https://github.com/keplerproject/luafilesystem">Git</a></li>
|
<li><a href="https://github.com/lunarmodules/luafilesystem">Git</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="license.html">License</a></li>
|
<li><a href="license.html">License</a></li>
|
||||||
@@ -102,15 +102,15 @@ LuaFileSystem offers the following functions:
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<dl class="reference">
|
<dl class="reference">
|
||||||
<dt><a name="attributes"></a><strong><code>lfs.attributes (filepath [, aname | atable])</code></strong></dt>
|
<dt><a name="attributes"></a><strong><code>lfs.attributes (filepath [, request_name | result_table])</code></strong></dt>
|
||||||
<dd>Returns a table with the file attributes corresponding to
|
<dd>Returns a table with the file attributes corresponding to
|
||||||
<code>filepath</code> (or <code>nil</code> followed by an error message and a system-dependent error code
|
<code>filepath</code> (or <code>nil</code> followed by an error message and a system-dependent error code
|
||||||
in case of error).
|
in case of error).
|
||||||
If the second optional argument is given and is a string, then only the value of the
|
If the second optional argument is given and is a string, then only the value of the
|
||||||
named attribute is returned (this use is equivalent to
|
named attribute is returned (this use is equivalent to
|
||||||
<code>lfs.attributes(filepath)[aname]</code>, but the table is not created
|
<code>lfs.attributes(filepath)[request_name]</code>, but the table is not created
|
||||||
and only one attribute is retrieved from the O.S.).
|
and only one attribute is retrieved from the O.S.).
|
||||||
if a table is passed as the second argument, it is filled with attributes and returned instead of a new table.
|
if a table is passed as the second argument, it (<code>result_table</code>) is filled with attributes and returned instead of a new table.
|
||||||
The attributes are described as follows;
|
The attributes are described as follows;
|
||||||
attribute <code>mode</code> is a string, all the others are numbers,
|
attribute <code>mode</code> is a string, all the others are numbers,
|
||||||
and the time related attributes use the same time reference of
|
and the time related attributes use the same time reference of
|
||||||
@@ -239,7 +239,7 @@ LuaFileSystem offers the following functions:
|
|||||||
setting the mode has no effect, and the mode is always returned as <code>binary</code>.
|
setting the mode has no effect, and the mode is always returned as <code>binary</code>.
|
||||||
</dd>
|
</dd>
|
||||||
|
|
||||||
<dt><a name="symlinkattributes"></a><strong><code>lfs.symlinkattributes (filepath [, aname])</code></strong></dt>
|
<dt><a name="symlinkattributes"></a><strong><code>lfs.symlinkattributes (filepath [, request_name])</code></strong></dt>
|
||||||
<dd>Identical to <a href="#attributes">lfs.attributes</a> except that
|
<dd>Identical to <a href="#attributes">lfs.attributes</a> except that
|
||||||
it obtains information about the link itself (not the file it refers to).
|
it obtains information about the link itself (not the file it refers to).
|
||||||
It also adds a <strong><code>target</code></strong> field, containing
|
It also adds a <strong><code>target</code></strong> field, containing
|
||||||
@@ -1,8 +1,7 @@
|
|||||||
package = "LuaFileSystem"
|
package = "luafilesystem"
|
||||||
version = "1.6.3-1"
|
version = "scm-1"
|
||||||
source = {
|
source = {
|
||||||
url = "git://github.com/keplerproject/luafilesystem",
|
url = "git+https://github.com/lunarmodules/luafilesystem"
|
||||||
tag = "v_1_6_3",
|
|
||||||
}
|
}
|
||||||
description = {
|
description = {
|
||||||
summary = "File System Library for the Lua Programming Language",
|
summary = "File System Library for the Lua Programming Language",
|
||||||
@@ -12,7 +11,7 @@ description = {
|
|||||||
distribution. LuaFileSystem offers a portable way to access the
|
distribution. LuaFileSystem offers a portable way to access the
|
||||||
underlying directory structure and file attributes.
|
underlying directory structure and file attributes.
|
||||||
]],
|
]],
|
||||||
license = "MIT/X11",
|
license = "MIT/X11"
|
||||||
}
|
}
|
||||||
dependencies = {
|
dependencies = {
|
||||||
"lua >= 5.1"
|
"lua >= 5.1"
|
||||||
@@ -23,6 +22,7 @@ build = {
|
|||||||
lfs = "src/lfs.c"
|
lfs = "src/lfs.c"
|
||||||
},
|
},
|
||||||
copy_directories = {
|
copy_directories = {
|
||||||
"doc", "tests"
|
"docs",
|
||||||
|
"tests"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
package = "LuaFileSystem"
|
|
||||||
version = "1.3.0-1"
|
|
||||||
source = {
|
|
||||||
url = "http://luaforge.net/frs/download.php/2679/luafilesystem-1.3.0.tar.gz"
|
|
||||||
}
|
|
||||||
description = {
|
|
||||||
summary = "File System Library for the Lua Programming Language",
|
|
||||||
detailed = [[
|
|
||||||
LuaFileSystem is a Lua library developed to complement the set of
|
|
||||||
functions related to file systems offered by the standard Lua
|
|
||||||
distribution. LuaFileSystem offers a portable way to access the
|
|
||||||
underlying directory structure and file attributes.
|
|
||||||
]]
|
|
||||||
}
|
|
||||||
dependencies = {
|
|
||||||
"lua >= 5.1"
|
|
||||||
}
|
|
||||||
build = {
|
|
||||||
type = "make",
|
|
||||||
build_variables = {
|
|
||||||
LUA_INC = "$(LUA_INCDIR)",
|
|
||||||
LIB_OPTION = "$(LIBFLAG)"
|
|
||||||
},
|
|
||||||
install_variables = {
|
|
||||||
LUA_LIBDIR = "$(LIBDIR)"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
package = "LuaFileSystem"
|
|
||||||
version = "1.4.0-1"
|
|
||||||
source = {
|
|
||||||
url = "http://luaforge.net/frs/download.php/3158/luafilesystem-1.4.0.tar.gz"
|
|
||||||
}
|
|
||||||
description = {
|
|
||||||
summary = "File System Library for the Lua Programming Language",
|
|
||||||
detailed = [[
|
|
||||||
LuaFileSystem is a Lua library developed to complement the set of
|
|
||||||
functions related to file systems offered by the standard Lua
|
|
||||||
distribution. LuaFileSystem offers a portable way to access the
|
|
||||||
underlying directory structure and file attributes.
|
|
||||||
]]
|
|
||||||
}
|
|
||||||
dependencies = {
|
|
||||||
"lua >= 5.1"
|
|
||||||
}
|
|
||||||
build = {
|
|
||||||
type = "make",
|
|
||||||
build_variables = {
|
|
||||||
LUA_INC = "$(LUA_INCDIR)",
|
|
||||||
LIB_OPTION = "$(LIBFLAG)"
|
|
||||||
},
|
|
||||||
install_variables = {
|
|
||||||
LUA_LIBDIR = "$(LIBDIR)"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
package = "LuaFileSystem"
|
|
||||||
version = "1.4.0-2"
|
|
||||||
source = {
|
|
||||||
url = "http://luaforge.net/frs/download.php/3158/luafilesystem-1.4.0.tar.gz"
|
|
||||||
}
|
|
||||||
description = {
|
|
||||||
summary = "File System Library for the Lua Programming Language",
|
|
||||||
detailed = [[
|
|
||||||
LuaFileSystem is a Lua library developed to complement the set of
|
|
||||||
functions related to file systems offered by the standard Lua
|
|
||||||
distribution. LuaFileSystem offers a portable way to access the
|
|
||||||
underlying directory structure and file attributes.
|
|
||||||
]]
|
|
||||||
}
|
|
||||||
dependencies = {
|
|
||||||
"lua >= 5.1"
|
|
||||||
}
|
|
||||||
build = {
|
|
||||||
platforms = {
|
|
||||||
unix = {
|
|
||||||
type = "make",
|
|
||||||
build_variables = {
|
|
||||||
LIB_OPTION = "$(LIBFLAG)",
|
|
||||||
CFLAGS = "$(CFLAGS) -I$(LUA_INCDIR)",
|
|
||||||
},
|
|
||||||
install_variables = {
|
|
||||||
LUA_LIBDIR = "$(LIBDIR)"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
win32 = {
|
|
||||||
type = "make",
|
|
||||||
build_variables = {
|
|
||||||
LUA_LIB = "$(LUA_LIBDIR)\\lua5.1.lib",
|
|
||||||
CFLAGS = "/MD $(CFLAGS) /I$(LUA_INCDIR)",
|
|
||||||
},
|
|
||||||
install_variables = {
|
|
||||||
LUA_LIBDIR = "$(LIBDIR)",
|
|
||||||
LUA_DIR = "$(LUADIR)",
|
|
||||||
BIN_DIR = "$(BINDIR)"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
package = "LuaFileSystem"
|
|
||||||
version = "1.4.1-1"
|
|
||||||
source = {
|
|
||||||
url = "http://luaforge.net/frs/download.php/3345/luafilesystem-1.4.1.tar.gz",
|
|
||||||
}
|
|
||||||
description = {
|
|
||||||
summary = "File System Library for the Lua Programming Language",
|
|
||||||
detailed = [[
|
|
||||||
LuaFileSystem is a Lua library developed to complement the set of
|
|
||||||
functions related to file systems offered by the standard Lua
|
|
||||||
distribution. LuaFileSystem offers a portable way to access the
|
|
||||||
underlying directory structure and file attributes.
|
|
||||||
]]
|
|
||||||
}
|
|
||||||
dependencies = {
|
|
||||||
"lua >= 5.1"
|
|
||||||
}
|
|
||||||
build = {
|
|
||||||
platforms = {
|
|
||||||
unix = {
|
|
||||||
type = "make",
|
|
||||||
build_variables = {
|
|
||||||
LIB_OPTION = "$(LIBFLAG)",
|
|
||||||
CFLAGS = "$(CFLAGS) -I$(LUA_INCDIR) $(STAT64)",
|
|
||||||
},
|
|
||||||
install_variables = {
|
|
||||||
LUA_LIBDIR = "$(LIBDIR)"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
win32 = {
|
|
||||||
type = "make",
|
|
||||||
build_variables = {
|
|
||||||
LUA_LIB = "$(LUA_LIBDIR)\\lua5.1.lib",
|
|
||||||
CFLAGS = "/MD $(CFLAGS) /I$(LUA_INCDIR)",
|
|
||||||
},
|
|
||||||
install_variables = {
|
|
||||||
LUA_LIBDIR = "$(LIBDIR)",
|
|
||||||
LUA_DIR = "$(LUADIR)",
|
|
||||||
BIN_DIR = "$(BINDIR)"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
package = "LuaFileSystem"
|
|
||||||
version = "1.4.1rc1-1"
|
|
||||||
source = {
|
|
||||||
url = "http://luafilesystem.luaforge.net/luafilesystem-1.4.1rc1.tar.gz",
|
|
||||||
}
|
|
||||||
description = {
|
|
||||||
summary = "File System Library for the Lua Programming Language",
|
|
||||||
detailed = [[
|
|
||||||
LuaFileSystem is a Lua library developed to complement the set of
|
|
||||||
functions related to file systems offered by the standard Lua
|
|
||||||
distribution. LuaFileSystem offers a portable way to access the
|
|
||||||
underlying directory structure and file attributes.
|
|
||||||
]]
|
|
||||||
}
|
|
||||||
dependencies = {
|
|
||||||
"lua >= 5.1"
|
|
||||||
}
|
|
||||||
build = {
|
|
||||||
platforms = {
|
|
||||||
unix = {
|
|
||||||
type = "make",
|
|
||||||
build_variables = {
|
|
||||||
LIB_OPTION = "$(LIBFLAG)",
|
|
||||||
CFLAGS = "$(CFLAGS) -I$(LUA_INCDIR) $(STAT64)",
|
|
||||||
},
|
|
||||||
install_variables = {
|
|
||||||
LUA_LIBDIR = "$(LIBDIR)"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
win32 = {
|
|
||||||
type = "make",
|
|
||||||
build_variables = {
|
|
||||||
LUA_LIB = "$(LUA_LIBDIR)\\lua5.1.lib",
|
|
||||||
CFLAGS = "/MD $(CFLAGS) /I$(LUA_INCDIR)",
|
|
||||||
},
|
|
||||||
install_variables = {
|
|
||||||
LUA_LIBDIR = "$(LIBDIR)",
|
|
||||||
LUA_DIR = "$(LUADIR)",
|
|
||||||
BIN_DIR = "$(BINDIR)"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
package = "LuaFileSystem"
|
|
||||||
|
|
||||||
version = "1.4.2-1"
|
|
||||||
|
|
||||||
source = {
|
|
||||||
url = "http://luaforge.net/frs/download.php/3931/luafilesystem-1.4.2.tar.gz",
|
|
||||||
}
|
|
||||||
|
|
||||||
description = {
|
|
||||||
summary = "File System Library for the Lua Programming Language",
|
|
||||||
detailed = [[
|
|
||||||
LuaFileSystem is a Lua library developed to complement the set of
|
|
||||||
functions related to file systems offered by the standard Lua
|
|
||||||
distribution. LuaFileSystem offers a portable way to access the
|
|
||||||
underlying directory structure and file attributes.
|
|
||||||
]]
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies = {
|
|
||||||
"lua >= 5.1"
|
|
||||||
}
|
|
||||||
|
|
||||||
build = {
|
|
||||||
type = "module",
|
|
||||||
modules = { lfs = "src/lfs.c" }
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
package = "LuaFileSystem"
|
|
||||||
|
|
||||||
version = "1.5.0-1"
|
|
||||||
|
|
||||||
source = {
|
|
||||||
url = "http://cloud.github.com/downloads/keplerproject/luafilesystem/luafilesystem-1.5.0.tar.gz",
|
|
||||||
}
|
|
||||||
|
|
||||||
description = {
|
|
||||||
summary = "File System Library for the Lua Programming Language",
|
|
||||||
detailed = [[
|
|
||||||
LuaFileSystem is a Lua library developed to complement the set of
|
|
||||||
functions related to file systems offered by the standard Lua
|
|
||||||
distribution. LuaFileSystem offers a portable way to access the
|
|
||||||
underlying directory structure and file attributes.
|
|
||||||
]]
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies = {
|
|
||||||
"lua >= 5.1"
|
|
||||||
}
|
|
||||||
|
|
||||||
build = {
|
|
||||||
type = "module",
|
|
||||||
modules = { lfs = "src/lfs.c" },
|
|
||||||
copy_directories = { "doc", "tests" }
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
package = "LuaFileSystem"
|
|
||||||
|
|
||||||
version = "1.6.0-1"
|
|
||||||
|
|
||||||
source = {
|
|
||||||
url = "https://github.com/downloads/keplerproject/luafilesystem/luafilesystem-1.6.0.tar.gz",
|
|
||||||
}
|
|
||||||
|
|
||||||
description = {
|
|
||||||
summary = "File System Library for the Lua Programming Language",
|
|
||||||
detailed = [[
|
|
||||||
LuaFileSystem is a Lua library developed to complement the set of
|
|
||||||
functions related to file systems offered by the standard Lua
|
|
||||||
distribution. LuaFileSystem offers a portable way to access the
|
|
||||||
underlying directory structure and file attributes.
|
|
||||||
]]
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies = {
|
|
||||||
"lua >= 5.1"
|
|
||||||
}
|
|
||||||
|
|
||||||
build = {
|
|
||||||
type = "builtin",
|
|
||||||
modules = { lfs = "src/lfs.c" },
|
|
||||||
copy_directories = { "doc", "tests" }
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
package = "LuaFileSystem"
|
|
||||||
|
|
||||||
version = "1.6.1-1"
|
|
||||||
|
|
||||||
source = {
|
|
||||||
url = "https://github.com/downloads/keplerproject/luafilesystem/luafilesystem-1.6.1.tar.gz",
|
|
||||||
}
|
|
||||||
|
|
||||||
description = {
|
|
||||||
summary = "File System Library for the Lua Programming Language",
|
|
||||||
detailed = [[
|
|
||||||
LuaFileSystem is a Lua library developed to complement the set of
|
|
||||||
functions related to file systems offered by the standard Lua
|
|
||||||
distribution. LuaFileSystem offers a portable way to access the
|
|
||||||
underlying directory structure and file attributes.
|
|
||||||
]]
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies = {
|
|
||||||
"lua >= 5.1"
|
|
||||||
}
|
|
||||||
|
|
||||||
build = {
|
|
||||||
type = "builtin",
|
|
||||||
modules = { lfs = "src/lfs.c" },
|
|
||||||
copy_directories = { "doc", "tests" }
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
package = "LuaFileSystem"
|
|
||||||
|
|
||||||
version = "1.6.2-1"
|
|
||||||
|
|
||||||
source = {
|
|
||||||
url = "https://github.com/downloads/keplerproject/luafilesystem/luafilesystem-1.6.2.tar.gz",
|
|
||||||
}
|
|
||||||
|
|
||||||
description = {
|
|
||||||
summary = "File System Library for the Lua Programming Language",
|
|
||||||
detailed = [[
|
|
||||||
LuaFileSystem is a Lua library developed to complement the set of
|
|
||||||
functions related to file systems offered by the standard Lua
|
|
||||||
distribution. LuaFileSystem offers a portable way to access the
|
|
||||||
underlying directory structure and file attributes.
|
|
||||||
]]
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies = {
|
|
||||||
"lua >= 5.1"
|
|
||||||
}
|
|
||||||
|
|
||||||
build = {
|
|
||||||
type = "builtin",
|
|
||||||
modules = { lfs = "src/lfs.c" },
|
|
||||||
copy_directories = { "doc", "tests" }
|
|
||||||
}
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
package = "LuaFileSystem"
|
|
||||||
version = "cvs-1"
|
|
||||||
source = {
|
|
||||||
url = "cvs://:pserver:anonymous:@cvs.luaforge.net:/cvsroot/luafilesystem",
|
|
||||||
cvs_tag = "HEAD"
|
|
||||||
}
|
|
||||||
description = {
|
|
||||||
summary = "File System Library for the Lua Programming Language",
|
|
||||||
detailed = [[
|
|
||||||
LuaFileSystem is a Lua library developed to complement the set of
|
|
||||||
functions related to file systems offered by the standard Lua
|
|
||||||
distribution. LuaFileSystem offers a portable way to access the
|
|
||||||
underlying directory structure and file attributes.
|
|
||||||
]]
|
|
||||||
}
|
|
||||||
dependencies = {
|
|
||||||
"lua >= 5.1"
|
|
||||||
}
|
|
||||||
build = {
|
|
||||||
platforms = {
|
|
||||||
unix = {
|
|
||||||
type = "make",
|
|
||||||
build_variables = {
|
|
||||||
LIB_OPTION = "$(LIBFLAG)",
|
|
||||||
CFLAGS = "$(CFLAGS) -I$(LUA_INCDIR)",
|
|
||||||
},
|
|
||||||
install_variables = {
|
|
||||||
LUA_LIBDIR = "$(LIBDIR)"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
win32 = {
|
|
||||||
type = "make",
|
|
||||||
build_variables = {
|
|
||||||
LUA_LIB = "$(LUA_LIBDIR)\\lua5.1.lib",
|
|
||||||
CFLAGS = "$(CFLAGS) /I$(LUA_INCDIR)",
|
|
||||||
},
|
|
||||||
install_variables = {
|
|
||||||
LUA_LIBDIR = "$(LIBDIR)",
|
|
||||||
LUA_DIR = "$(LUADIR)",
|
|
||||||
BIN_DIR = "$(BINDIR)"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
package = "LuaFileSystem"
|
|
||||||
|
|
||||||
version = "cvs-2"
|
|
||||||
|
|
||||||
source = {
|
|
||||||
url = "git://github.com/keplerproject/luafilesystem.git",
|
|
||||||
}
|
|
||||||
|
|
||||||
description = {
|
|
||||||
summary = "File System Library for the Lua Programming Language",
|
|
||||||
detailed = [[
|
|
||||||
LuaFileSystem is a Lua library developed to complement the set of
|
|
||||||
functions related to file systems offered by the standard Lua
|
|
||||||
distribution. LuaFileSystem offers a portable way to access the
|
|
||||||
underlying directory structure and file attributes.
|
|
||||||
]]
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies = {
|
|
||||||
"lua >= 5.1"
|
|
||||||
}
|
|
||||||
|
|
||||||
build = {
|
|
||||||
type = "module",
|
|
||||||
modules = { lfs = "src/lfs.c" }
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
package = "LuaFileSystem"
|
|
||||||
|
|
||||||
version = "cvs-3"
|
|
||||||
|
|
||||||
source = {
|
|
||||||
url = "git://github.com/keplerproject/luafilesystem.git",
|
|
||||||
}
|
|
||||||
|
|
||||||
description = {
|
|
||||||
summary = "File System Library for the Lua Programming Language",
|
|
||||||
detailed = [[
|
|
||||||
LuaFileSystem is a Lua library developed to complement the set of
|
|
||||||
functions related to file systems offered by the standard Lua
|
|
||||||
distribution. LuaFileSystem offers a portable way to access the
|
|
||||||
underlying directory structure and file attributes.
|
|
||||||
]]
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies = {
|
|
||||||
"lua >= 5.1, < 5.4"
|
|
||||||
}
|
|
||||||
|
|
||||||
build = {
|
|
||||||
type = "builtin",
|
|
||||||
modules = { lfs = "src/lfs.c" },
|
|
||||||
copy_directories = { "doc", "tests" }
|
|
||||||
}
|
|
||||||
574
src/lfs.c
574
src/lfs.c
@@ -1,22 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
** LuaFileSystem
|
** LuaFileSystem
|
||||||
** Copyright Kepler Project 2003 - 2016 (http://keplerproject.github.io/luafilesystem)
|
** File system manipulation library
|
||||||
**
|
**
|
||||||
** File system manipulation library.
|
** Copyright (C) 2003-2010 Kepler Project.
|
||||||
** This library offers these functions:
|
** Copyright (C) 2010-2022 The LuaFileSystem authors.
|
||||||
** lfs.attributes (filepath [, attributename | attributetable])
|
** (http://lunarmodules.github.io/luafilesystem)
|
||||||
** lfs.chdir (path)
|
|
||||||
** lfs.currentdir ()
|
|
||||||
** lfs.dir (path)
|
|
||||||
** lfs.link (old, new[, symlink])
|
|
||||||
** lfs.lock (fh, mode)
|
|
||||||
** lfs.lock_dir (path)
|
|
||||||
** lfs.mkdir (path)
|
|
||||||
** lfs.rmdir (path)
|
|
||||||
** lfs.setmode (filepath, mode)
|
|
||||||
** lfs.symlinkattributes (filepath [, attributename])
|
|
||||||
** lfs.touch (filepath [, atime [, mtime]])
|
|
||||||
** lfs.unlock (fh)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef LFS_DO_NOT_USE_LARGE_FILE
|
#ifndef LFS_DO_NOT_USE_LARGE_FILE
|
||||||
@@ -29,6 +17,10 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#define _WIN32_WINNT 0x600
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef LFS_DO_NOT_USE_LARGE_FILE
|
#ifndef LFS_DO_NOT_USE_LARGE_FILE
|
||||||
#define _LARGEFILE64_SOURCE
|
#define _LARGEFILE64_SOURCE
|
||||||
#endif
|
#endif
|
||||||
@@ -41,26 +33,39 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
#include <direct.h>
|
#include <direct.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#include <sys/locking.h>
|
#include <sys/locking.h>
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
#ifdef __BORLANDC__
|
||||||
#include <utime.h>
|
#include <utime.h>
|
||||||
#else
|
#else
|
||||||
#include <sys/utime.h>
|
#include <sys/utime.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
/* MAX_PATH seems to be 260. Seems kind of small. Is there a better one? */
|
/* MAX_PATH seems to be 260. Seems kind of small. Is there a better one? */
|
||||||
#define LFS_MAXPATHLEN MAX_PATH
|
#define LFS_MAXPATHLEN MAX_PATH
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <utime.h>
|
#include <utime.h>
|
||||||
#include <sys/param.h> /* for MAXPATHLEN */
|
#include <sys/param.h> /* for MAXPATHLEN */
|
||||||
|
|
||||||
|
#ifdef MAXPATHLEN
|
||||||
#define LFS_MAXPATHLEN MAXPATHLEN
|
#define LFS_MAXPATHLEN MAXPATHLEN
|
||||||
|
#else
|
||||||
|
#include <limits.h> /* for _POSIX_PATH_MAX */
|
||||||
|
#define LFS_MAXPATHLEN _POSIX_PATH_MAX
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <lua.h>
|
#include <lua.h>
|
||||||
@@ -69,10 +74,10 @@
|
|||||||
|
|
||||||
#include "lfs.h"
|
#include "lfs.h"
|
||||||
|
|
||||||
#define LFS_VERSION "1.6.3"
|
#define LFS_VERSION "1.9.0"
|
||||||
#define LFS_LIBNAME "lfs"
|
#define LFS_LIBNAME "lfs"
|
||||||
|
|
||||||
#if LUA_VERSION_NUM >= 503 /* Lua 5.3 */
|
#if LUA_VERSION_NUM >= 503 /* Lua 5.3+ */
|
||||||
|
|
||||||
#ifndef luaL_optlong
|
#ifndef luaL_optlong
|
||||||
#define luaL_optlong luaL_optinteger
|
#define luaL_optlong luaL_optinteger
|
||||||
@@ -80,8 +85,10 @@
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LUA_VERSION_NUM < 502
|
#if LUA_VERSION_NUM >= 502
|
||||||
# define luaL_newlib(L,l) (lua_newtable(L), luaL_register(L,NULL,l))
|
#define new_lib(L, l) (luaL_newlib(L, l))
|
||||||
|
#else
|
||||||
|
#define new_lib(L, l) (lua_newtable(L), luaL_register(L, NULL, l))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Define 'strerror' for systems that do not implement it */
|
/* Define 'strerror' for systems that do not implement it */
|
||||||
@@ -103,6 +110,7 @@ typedef struct dir_data {
|
|||||||
#define LOCK_METATABLE "lock metatable"
|
#define LOCK_METATABLE "lock metatable"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
#ifdef __BORLANDC__
|
||||||
#define lfs_setmode(file, m) (setmode(_fileno(file), m))
|
#define lfs_setmode(file, m) (setmode(_fileno(file), m))
|
||||||
#define STAT_STRUCT struct stati64
|
#define STAT_STRUCT struct stati64
|
||||||
@@ -110,15 +118,45 @@ typedef struct dir_data {
|
|||||||
#define lfs_setmode(file, m) (_setmode(_fileno(file), m))
|
#define lfs_setmode(file, m) (_setmode(_fileno(file), m))
|
||||||
#define STAT_STRUCT struct _stati64
|
#define STAT_STRUCT struct _stati64
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef _S_IFLNK
|
||||||
|
#define _S_IFLNK 0x400
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef S_ISDIR
|
||||||
|
#define S_ISDIR(mode) (mode&_S_IFDIR)
|
||||||
|
#endif
|
||||||
|
#ifndef S_ISREG
|
||||||
|
#define S_ISREG(mode) (mode&_S_IFREG)
|
||||||
|
#endif
|
||||||
|
#ifndef S_ISLNK
|
||||||
|
#define S_ISLNK(mode) (mode&_S_IFLNK)
|
||||||
|
#endif
|
||||||
|
#ifndef S_ISSOCK
|
||||||
|
#define S_ISSOCK(mode) (0)
|
||||||
|
#endif
|
||||||
|
#ifndef S_ISFIFO
|
||||||
|
#define S_ISFIFO(mode) (0)
|
||||||
|
#endif
|
||||||
|
#ifndef S_ISCHR
|
||||||
|
#define S_ISCHR(mode) (mode&_S_IFCHR)
|
||||||
|
#endif
|
||||||
|
#ifndef S_ISBLK
|
||||||
|
#define S_ISBLK(mode) (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
#define STAT_FUNC _stati64
|
#define STAT_FUNC _stati64
|
||||||
#define LSTAT_FUNC STAT_FUNC
|
#define LSTAT_FUNC lfs_win32_lstat
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#define _O_TEXT 0
|
#define _O_TEXT 0
|
||||||
#define _O_BINARY 0
|
#define _O_BINARY 0
|
||||||
#define lfs_setmode(file, m) ((void)file, (void)m, 0)
|
#define lfs_setmode(file, m) ((void)file, (void)m, 0)
|
||||||
#define STAT_STRUCT struct stat
|
#define STAT_STRUCT struct stat
|
||||||
#define STAT_FUNC stat
|
#define STAT_FUNC stat
|
||||||
#define LSTAT_FUNC lstat
|
#define LSTAT_FUNC lstat
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@@ -128,6 +166,55 @@ typedef struct dir_data {
|
|||||||
S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IXOTH))
|
S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IXOTH))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
|
||||||
|
static int lfs_win32_pusherror(lua_State * L)
|
||||||
|
{
|
||||||
|
int en = GetLastError();
|
||||||
|
lua_pushnil(L);
|
||||||
|
if (en == ERROR_FILE_EXISTS || en == ERROR_SHARING_VIOLATION)
|
||||||
|
lua_pushstring(L, "File exists");
|
||||||
|
else
|
||||||
|
lua_pushstring(L, strerror(en));
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define TICKS_PER_SECOND 10000000
|
||||||
|
#define EPOCH_DIFFERENCE 11644473600LL
|
||||||
|
static time_t windowsToUnixTime(FILETIME ft)
|
||||||
|
{
|
||||||
|
ULARGE_INTEGER uli;
|
||||||
|
uli.LowPart = ft.dwLowDateTime;
|
||||||
|
uli.HighPart = ft.dwHighDateTime;
|
||||||
|
return (time_t) (uli.QuadPart / TICKS_PER_SECOND - EPOCH_DIFFERENCE);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int lfs_win32_lstat(const char *path, STAT_STRUCT * buffer)
|
||||||
|
{
|
||||||
|
WIN32_FILE_ATTRIBUTE_DATA win32buffer;
|
||||||
|
if (GetFileAttributesEx(path, GetFileExInfoStandard, &win32buffer)) {
|
||||||
|
if (!(win32buffer.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)) {
|
||||||
|
return STAT_FUNC(path, buffer);
|
||||||
|
}
|
||||||
|
buffer->st_mode = _S_IFLNK;
|
||||||
|
buffer->st_dev = 0;
|
||||||
|
buffer->st_ino = 0;
|
||||||
|
buffer->st_nlink = 0;
|
||||||
|
buffer->st_uid = 0;
|
||||||
|
buffer->st_gid = 0;
|
||||||
|
buffer->st_rdev = 0;
|
||||||
|
buffer->st_atime = windowsToUnixTime(win32buffer.ftLastAccessTime);
|
||||||
|
buffer->st_mtime = windowsToUnixTime(win32buffer.ftLastWriteTime);
|
||||||
|
buffer->st_ctime = windowsToUnixTime(win32buffer.ftCreationTime);
|
||||||
|
buffer->st_size = 0;
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Utility functions
|
** Utility functions
|
||||||
*/
|
*/
|
||||||
@@ -142,7 +229,8 @@ static int pusherror(lua_State *L, const char *info)
|
|||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pushresult(lua_State *L, int res, const char *info) {
|
static int pushresult(lua_State * L, int res, const char *info)
|
||||||
|
{
|
||||||
if (res == -1) {
|
if (res == -1) {
|
||||||
return pusherror(L, info);
|
return pusherror(L, info);
|
||||||
} else {
|
} else {
|
||||||
@@ -155,7 +243,8 @@ static int pushresult(lua_State *L, int res, const char *info) {
|
|||||||
/*
|
/*
|
||||||
** This function changes the working (current) directory
|
** This function changes the working (current) directory
|
||||||
*/
|
*/
|
||||||
static int change_dir (lua_State *L) {
|
static int change_dir(lua_State * L)
|
||||||
|
{
|
||||||
const char *path = luaL_checkstring(L, 1);
|
const char *path = luaL_checkstring(L, 1);
|
||||||
if (chdir(path)) {
|
if (chdir(path)) {
|
||||||
lua_pushnil(L);
|
lua_pushnil(L);
|
||||||
@@ -173,21 +262,26 @@ static int change_dir (lua_State *L) {
|
|||||||
** If unable to get the current directory, it returns nil
|
** If unable to get the current directory, it returns nil
|
||||||
** and a string describing the error
|
** and a string describing the error
|
||||||
*/
|
*/
|
||||||
static int get_dir (lua_State *L) {
|
static int get_dir(lua_State * L)
|
||||||
|
{
|
||||||
#ifdef NO_GETCWD
|
#ifdef NO_GETCWD
|
||||||
lua_pushnil(L);
|
lua_pushnil(L);
|
||||||
lua_pushstring(L, "Function 'getcwd' not provided by system");
|
lua_pushstring(L, "Function 'getcwd' not provided by system");
|
||||||
return 2;
|
return 2;
|
||||||
#else
|
#else
|
||||||
char *path = NULL;
|
char *path = NULL;
|
||||||
/* Passing (NULL, 0) is not guaranteed to work. Use a temp buffer and size instead. */
|
/* Passing (NULL, 0) is not guaranteed to work.
|
||||||
|
Use a temp buffer and size instead. */
|
||||||
size_t size = LFS_MAXPATHLEN; /* initial buffer size */
|
size_t size = LFS_MAXPATHLEN; /* initial buffer size */
|
||||||
int result;
|
int result;
|
||||||
while (1) {
|
while (1) {
|
||||||
path = realloc(path, size);
|
char *path2 = (char *)realloc(path, size);
|
||||||
if (!path) /* failed to allocate */
|
if (!path2) { /* failed to allocate */
|
||||||
return pusherror(L, "get_dir realloc() failed");
|
result = pusherror(L, "get_dir realloc() failed");
|
||||||
if (getcwd(path, size) != NULL) {
|
break;
|
||||||
|
}
|
||||||
|
path = path2;
|
||||||
|
if (getcwd(path, (int)size) != NULL) {
|
||||||
/* success, push the path to the Lua stack */
|
/* success, push the path to the Lua stack */
|
||||||
lua_pushstring(L, path);
|
lua_pushstring(L, path);
|
||||||
result = 1;
|
result = 1;
|
||||||
@@ -208,7 +302,8 @@ static int get_dir (lua_State *L) {
|
|||||||
/*
|
/*
|
||||||
** Check if the given element on the stack is a file and returns it.
|
** Check if the given element on the stack is a file and returns it.
|
||||||
*/
|
*/
|
||||||
static FILE *check_file (lua_State *L, int idx, const char *funcname) {
|
static FILE *check_file(lua_State * L, int idx, const char *funcname)
|
||||||
|
{
|
||||||
#if LUA_VERSION_NUM == 501
|
#if LUA_VERSION_NUM == 501
|
||||||
FILE **fh = (FILE **) luaL_checkudata(L, idx, "FILE*");
|
FILE **fh = (FILE **) luaL_checkudata(L, idx, "FILE*");
|
||||||
if (*fh == NULL) {
|
if (*fh == NULL) {
|
||||||
@@ -216,7 +311,7 @@ static FILE *check_file (lua_State *L, int idx, const char *funcname) {
|
|||||||
return 0;
|
return 0;
|
||||||
} else
|
} else
|
||||||
return *fh;
|
return *fh;
|
||||||
#elif LUA_VERSION_NUM >= 502 && LUA_VERSION_NUM <= 503
|
#elif LUA_VERSION_NUM >= 502 && LUA_VERSION_NUM <= 505
|
||||||
luaL_Stream *fh = (luaL_Stream *) luaL_checkudata(L, idx, "FILE*");
|
luaL_Stream *fh = (luaL_Stream *) luaL_checkudata(L, idx, "FILE*");
|
||||||
if (fh->closef == 0 || fh->f == NULL) {
|
if (fh->closef == 0 || fh->f == NULL) {
|
||||||
luaL_error(L, "%s: closed file", funcname);
|
luaL_error(L, "%s: closed file", funcname);
|
||||||
@@ -232,26 +327,41 @@ static FILE *check_file (lua_State *L, int idx, const char *funcname) {
|
|||||||
/*
|
/*
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
static int _file_lock (lua_State *L, FILE *fh, const char *mode, const long start, long len, const char *funcname) {
|
static int _file_lock(lua_State * L, FILE * fh, const char *mode,
|
||||||
|
const long start, long len, const char *funcname)
|
||||||
|
{
|
||||||
int code;
|
int code;
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
/* lkmode valid values are:
|
/* lkmode valid values are:
|
||||||
LK_LOCK Locks the specified bytes. If the bytes cannot be locked, the program immediately tries again after 1 second. If, after 10 attempts, the bytes cannot be locked, the constant returns an error.
|
LK_LOCK Locks the specified bytes. If the bytes cannot be locked,
|
||||||
LK_NBLCK Locks the specified bytes. If the bytes cannot be locked, the constant returns an error.
|
the program immediately tries again after 1 second.
|
||||||
|
If, after 10 attempts, the bytes cannot be locked,
|
||||||
|
the constant returns an error.
|
||||||
|
LK_NBLCK Locks the specified bytes. If the bytes cannot be locked,
|
||||||
|
the constant returns an error.
|
||||||
LK_NBRLCK Same as _LK_NBLCK.
|
LK_NBRLCK Same as _LK_NBLCK.
|
||||||
LK_RLCK Same as _LK_LOCK.
|
LK_RLCK Same as _LK_LOCK.
|
||||||
LK_UNLCK Unlocks the specified bytes, which must have been previously locked.
|
LK_UNLCK Unlocks the specified bytes, which must have been
|
||||||
|
previously locked.
|
||||||
|
|
||||||
Regions should be locked only briefly and should be unlocked before closing a file or exiting the program.
|
Regions should be locked only briefly and should be unlocked
|
||||||
|
before closing a file or exiting the program.
|
||||||
|
|
||||||
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt__locking.asp
|
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt__locking.asp
|
||||||
*/
|
*/
|
||||||
int lkmode;
|
int lkmode;
|
||||||
switch (*mode) {
|
switch (*mode) {
|
||||||
case 'r': lkmode = LK_NBLCK; break;
|
case 'r':
|
||||||
case 'w': lkmode = LK_NBLCK; break;
|
lkmode = LK_NBLCK;
|
||||||
case 'u': lkmode = LK_UNLCK; break;
|
break;
|
||||||
default : return luaL_error (L, "%s: invalid mode", funcname);
|
case 'w':
|
||||||
|
lkmode = LK_NBLCK;
|
||||||
|
break;
|
||||||
|
case 'u':
|
||||||
|
lkmode = LK_UNLCK;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return luaL_error(L, "%s: invalid mode", funcname);
|
||||||
}
|
}
|
||||||
if (!len) {
|
if (!len) {
|
||||||
fseek(fh, 0L, SEEK_END);
|
fseek(fh, 0L, SEEK_END);
|
||||||
@@ -266,10 +376,17 @@ static int _file_lock (lua_State *L, FILE *fh, const char *mode, const long star
|
|||||||
#else
|
#else
|
||||||
struct flock f;
|
struct flock f;
|
||||||
switch (*mode) {
|
switch (*mode) {
|
||||||
case 'w': f.l_type = F_WRLCK; break;
|
case 'w':
|
||||||
case 'r': f.l_type = F_RDLCK; break;
|
f.l_type = F_WRLCK;
|
||||||
case 'u': f.l_type = F_UNLCK; break;
|
break;
|
||||||
default : return luaL_error (L, "%s: invalid mode", funcname);
|
case 'r':
|
||||||
|
f.l_type = F_RDLCK;
|
||||||
|
break;
|
||||||
|
case 'u':
|
||||||
|
f.l_type = F_UNLCK;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return luaL_error(L, "%s: invalid mode", funcname);
|
||||||
}
|
}
|
||||||
f.l_whence = SEEK_SET;
|
f.l_whence = SEEK_SET;
|
||||||
f.l_start = (off_t) start;
|
f.l_start = (off_t) start;
|
||||||
@@ -283,35 +400,37 @@ static int _file_lock (lua_State *L, FILE *fh, const char *mode, const long star
|
|||||||
typedef struct lfs_Lock {
|
typedef struct lfs_Lock {
|
||||||
HANDLE fd;
|
HANDLE fd;
|
||||||
} lfs_Lock;
|
} lfs_Lock;
|
||||||
static int lfs_lock_dir(lua_State *L) {
|
static int lfs_lock_dir(lua_State * L)
|
||||||
size_t pathl; HANDLE fd;
|
{
|
||||||
|
size_t pathl;
|
||||||
|
HANDLE fd;
|
||||||
lfs_Lock *lock;
|
lfs_Lock *lock;
|
||||||
char *ln;
|
char *ln;
|
||||||
const char *lockfile = "/lockfile.lfs";
|
const char *lockfile = "/lockfile.lfs";
|
||||||
const char *path = luaL_checklstring(L, 1, &pathl);
|
const char *path = luaL_checklstring(L, 1, &pathl);
|
||||||
ln = (char *) malloc(pathl + strlen(lockfile) + 1);
|
ln = (char *) malloc(pathl + strlen(lockfile) + 1);
|
||||||
if (!ln) {
|
if (!ln) {
|
||||||
lua_pushnil(L); lua_pushstring(L, strerror(errno)); return 2;
|
lua_pushnil(L);
|
||||||
}
|
lua_pushstring(L, strerror(errno));
|
||||||
strcpy(ln, path); strcat(ln, lockfile);
|
|
||||||
if((fd = CreateFile(ln, GENERIC_WRITE, 0, NULL, CREATE_NEW,
|
|
||||||
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_DELETE_ON_CLOSE, NULL)) == INVALID_HANDLE_VALUE) {
|
|
||||||
int en = GetLastError();
|
|
||||||
free(ln); lua_pushnil(L);
|
|
||||||
if(en == ERROR_FILE_EXISTS || en == ERROR_SHARING_VIOLATION)
|
|
||||||
lua_pushstring(L, "File exists");
|
|
||||||
else
|
|
||||||
lua_pushstring(L, strerror(en));
|
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
strcpy(ln, path);
|
||||||
|
strcat(ln, lockfile);
|
||||||
|
fd = CreateFile(ln, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
|
||||||
|
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_DELETE_ON_CLOSE, NULL);
|
||||||
free(ln);
|
free(ln);
|
||||||
|
if (fd == INVALID_HANDLE_VALUE) {
|
||||||
|
return lfs_win32_pusherror(L);
|
||||||
|
}
|
||||||
lock = (lfs_Lock *) lua_newuserdata(L, sizeof(lfs_Lock));
|
lock = (lfs_Lock *) lua_newuserdata(L, sizeof(lfs_Lock));
|
||||||
lock->fd = fd;
|
lock->fd = fd;
|
||||||
luaL_getmetatable(L, LOCK_METATABLE);
|
luaL_getmetatable(L, LOCK_METATABLE);
|
||||||
lua_setmetatable(L, -2);
|
lua_setmetatable(L, -2);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
static int lfs_unlock_dir(lua_State *L) {
|
|
||||||
|
static int lfs_unlock_dir(lua_State * L)
|
||||||
|
{
|
||||||
lfs_Lock *lock = (lfs_Lock *) luaL_checkudata(L, 1, LOCK_METATABLE);
|
lfs_Lock *lock = (lfs_Lock *) luaL_checkudata(L, 1, LOCK_METATABLE);
|
||||||
if (lock->fd != INVALID_HANDLE_VALUE) {
|
if (lock->fd != INVALID_HANDLE_VALUE) {
|
||||||
CloseHandle(lock->fd);
|
CloseHandle(lock->fd);
|
||||||
@@ -323,7 +442,8 @@ static int lfs_unlock_dir(lua_State *L) {
|
|||||||
typedef struct lfs_Lock {
|
typedef struct lfs_Lock {
|
||||||
char *ln;
|
char *ln;
|
||||||
} lfs_Lock;
|
} lfs_Lock;
|
||||||
static int lfs_lock_dir(lua_State *L) {
|
static int lfs_lock_dir(lua_State * L)
|
||||||
|
{
|
||||||
lfs_Lock *lock;
|
lfs_Lock *lock;
|
||||||
size_t pathl;
|
size_t pathl;
|
||||||
char *ln;
|
char *ln;
|
||||||
@@ -332,19 +452,26 @@ static int lfs_lock_dir(lua_State *L) {
|
|||||||
lock = (lfs_Lock *) lua_newuserdata(L, sizeof(lfs_Lock));
|
lock = (lfs_Lock *) lua_newuserdata(L, sizeof(lfs_Lock));
|
||||||
ln = (char *) malloc(pathl + strlen(lockfile) + 1);
|
ln = (char *) malloc(pathl + strlen(lockfile) + 1);
|
||||||
if (!ln) {
|
if (!ln) {
|
||||||
lua_pushnil(L); lua_pushstring(L, strerror(errno)); return 2;
|
lua_pushnil(L);
|
||||||
|
lua_pushstring(L, strerror(errno));
|
||||||
|
return 2;
|
||||||
}
|
}
|
||||||
strcpy(ln, path); strcat(ln, lockfile);
|
strcpy(ln, path);
|
||||||
|
strcat(ln, lockfile);
|
||||||
if (symlink("lock", ln) == -1) {
|
if (symlink("lock", ln) == -1) {
|
||||||
free(ln); lua_pushnil(L);
|
free(ln);
|
||||||
lua_pushstring(L, strerror(errno)); return 2;
|
lua_pushnil(L);
|
||||||
|
lua_pushstring(L, strerror(errno));
|
||||||
|
return 2;
|
||||||
}
|
}
|
||||||
lock->ln = ln;
|
lock->ln = ln;
|
||||||
luaL_getmetatable(L, LOCK_METATABLE);
|
luaL_getmetatable(L, LOCK_METATABLE);
|
||||||
lua_setmetatable(L, -2);
|
lua_setmetatable(L, -2);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
static int lfs_unlock_dir(lua_State *L) {
|
|
||||||
|
static int lfs_unlock_dir(lua_State * L)
|
||||||
|
{
|
||||||
lfs_Lock *lock = (lfs_Lock *) luaL_checkudata(L, 1, LOCK_METATABLE);
|
lfs_Lock *lock = (lfs_Lock *) luaL_checkudata(L, 1, LOCK_METATABLE);
|
||||||
if (lock->ln) {
|
if (lock->ln) {
|
||||||
unlink(lock->ln);
|
unlink(lock->ln);
|
||||||
@@ -355,7 +482,8 @@ static int lfs_unlock_dir(lua_State *L) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int lfs_g_setmode (lua_State *L, FILE *f, int arg) {
|
static int lfs_g_setmode(lua_State * L, FILE * f, int arg)
|
||||||
|
{
|
||||||
static const int mode[] = { _O_BINARY, _O_TEXT };
|
static const int mode[] = { _O_BINARY, _O_TEXT };
|
||||||
static const char *const modenames[] = { "binary", "text", NULL };
|
static const char *const modenames[] = { "binary", "text", NULL };
|
||||||
int op = luaL_checkoption(L, arg, NULL, modenames);
|
int op = luaL_checkoption(L, arg, NULL, modenames);
|
||||||
@@ -376,7 +504,8 @@ static int lfs_g_setmode (lua_State *L, FILE *f, int arg) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int lfs_f_setmode(lua_State *L) {
|
static int lfs_f_setmode(lua_State * L)
|
||||||
|
{
|
||||||
return lfs_g_setmode(L, check_file(L, 1, "setmode"), 2);
|
return lfs_g_setmode(L, check_file(L, 1, "setmode"), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -387,7 +516,8 @@ static int lfs_f_setmode(lua_State *L) {
|
|||||||
** @param #3 Number with start position (optional).
|
** @param #3 Number with start position (optional).
|
||||||
** @param #4 Number with length (optional).
|
** @param #4 Number with length (optional).
|
||||||
*/
|
*/
|
||||||
static int file_lock (lua_State *L) {
|
static int file_lock(lua_State * L)
|
||||||
|
{
|
||||||
FILE *fh = check_file(L, 1, "lock");
|
FILE *fh = check_file(L, 1, "lock");
|
||||||
const char *mode = luaL_checkstring(L, 2);
|
const char *mode = luaL_checkstring(L, 2);
|
||||||
const long start = (long) luaL_optinteger(L, 3, 0);
|
const long start = (long) luaL_optinteger(L, 3, 0);
|
||||||
@@ -409,7 +539,8 @@ static int file_lock (lua_State *L) {
|
|||||||
** @param #2 Number with start position (optional).
|
** @param #2 Number with start position (optional).
|
||||||
** @param #3 Number with length (optional).
|
** @param #3 Number with length (optional).
|
||||||
*/
|
*/
|
||||||
static int file_unlock (lua_State *L) {
|
static int file_unlock(lua_State * L)
|
||||||
|
{
|
||||||
FILE *fh = check_file(L, 1, "unlock");
|
FILE *fh = check_file(L, 1, "unlock");
|
||||||
const long start = (long) luaL_optinteger(L, 2, 0);
|
const long start = (long) luaL_optinteger(L, 2, 0);
|
||||||
long len = (long) luaL_optinteger(L, 3, 0);
|
long len = (long) luaL_optinteger(L, 3, 0);
|
||||||
@@ -430,20 +561,40 @@ static int file_unlock (lua_State *L) {
|
|||||||
** @param #2 Name of link.
|
** @param #2 Name of link.
|
||||||
** @param #3 True if link is symbolic (optional).
|
** @param #3 True if link is symbolic (optional).
|
||||||
*/
|
*/
|
||||||
static int make_link (lua_State *L) {
|
static int make_link(lua_State * L)
|
||||||
#ifndef _WIN32
|
{
|
||||||
const char *oldpath = luaL_checkstring(L, 1);
|
const char *oldpath = luaL_checkstring(L, 1);
|
||||||
const char *newpath = luaL_checkstring(L, 2);
|
const char *newpath = luaL_checkstring(L, 2);
|
||||||
int res = (lua_toboolean(L,3) ? symlink : link)(oldpath, newpath);
|
#ifndef _WIN32
|
||||||
if (res == -1) {
|
return pushresult(L,
|
||||||
return pusherror(L, NULL);
|
(lua_toboolean(L, 3) ? symlink : link) (oldpath,
|
||||||
} else {
|
newpath),
|
||||||
lua_pushinteger(L, 0);
|
NULL);
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
errno = ENOSYS; /* = "Function not implemented" */
|
int symbolic = lua_toboolean(L, 3);
|
||||||
return pushresult(L, -1, "make_link is not supported on Windows");
|
STAT_STRUCT oldpathinfo;
|
||||||
|
int is_dir = 0;
|
||||||
|
if (STAT_FUNC(oldpath, &oldpathinfo) == 0) {
|
||||||
|
is_dir = S_ISDIR(oldpathinfo.st_mode) != 0;
|
||||||
|
}
|
||||||
|
if (!symbolic && is_dir) {
|
||||||
|
lua_pushnil(L);
|
||||||
|
lua_pushstring(L,
|
||||||
|
"hard links to directories are not supported on Windows");
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
int result = symbolic ? CreateSymbolicLink(newpath, oldpath, is_dir)
|
||||||
|
: CreateHardLink(newpath, oldpath, NULL);
|
||||||
|
|
||||||
|
if (result) {
|
||||||
|
return pushresult(L, result, NULL);
|
||||||
|
} else {
|
||||||
|
lua_pushnil(L);
|
||||||
|
lua_pushstring(L, symbolic ? "make_link CreateSymbolicLink() failed"
|
||||||
|
: "make_link CreateHardLink() failed");
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -452,7 +603,8 @@ static int make_link (lua_State *L) {
|
|||||||
** Creates a directory.
|
** Creates a directory.
|
||||||
** @param #1 Directory path.
|
** @param #1 Directory path.
|
||||||
*/
|
*/
|
||||||
static int make_dir (lua_State *L) {
|
static int make_dir(lua_State * L)
|
||||||
|
{
|
||||||
const char *path = luaL_checkstring(L, 1);
|
const char *path = luaL_checkstring(L, 1);
|
||||||
return pushresult(L, lfs_mkdir(path), NULL);
|
return pushresult(L, lfs_mkdir(path), NULL);
|
||||||
}
|
}
|
||||||
@@ -462,7 +614,8 @@ static int make_dir (lua_State *L) {
|
|||||||
** Removes a directory.
|
** Removes a directory.
|
||||||
** @param #1 Directory path.
|
** @param #1 Directory path.
|
||||||
*/
|
*/
|
||||||
static int remove_dir (lua_State *L) {
|
static int remove_dir(lua_State * L)
|
||||||
|
{
|
||||||
const char *path = luaL_checkstring(L, 1);
|
const char *path = luaL_checkstring(L, 1);
|
||||||
return pushresult(L, rmdir(path), NULL);
|
return pushresult(L, rmdir(path), NULL);
|
||||||
}
|
}
|
||||||
@@ -471,7 +624,8 @@ static int remove_dir (lua_State *L) {
|
|||||||
/*
|
/*
|
||||||
** Directory iterator
|
** Directory iterator
|
||||||
*/
|
*/
|
||||||
static int dir_iter (lua_State *L) {
|
static int dir_iter(lua_State * L)
|
||||||
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
struct _finddata_t c_file;
|
struct _finddata_t c_file;
|
||||||
#else
|
#else
|
||||||
@@ -518,7 +672,8 @@ static int dir_iter (lua_State *L) {
|
|||||||
/*
|
/*
|
||||||
** Closes directory iterators
|
** Closes directory iterators
|
||||||
*/
|
*/
|
||||||
static int dir_close (lua_State *L) {
|
static int dir_close(lua_State * L)
|
||||||
|
{
|
||||||
dir_data *d = (dir_data *) lua_touserdata(L, 1);
|
dir_data *d = (dir_data *) lua_touserdata(L, 1);
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (!d->closed && d->hFile) {
|
if (!d->closed && d->hFile) {
|
||||||
@@ -537,7 +692,8 @@ static int dir_close (lua_State *L) {
|
|||||||
/*
|
/*
|
||||||
** Factory of directory iterators
|
** Factory of directory iterators
|
||||||
*/
|
*/
|
||||||
static int dir_iter_factory (lua_State *L) {
|
static int dir_iter_factory(lua_State * L)
|
||||||
|
{
|
||||||
const char *path = luaL_checkstring(L, 1);
|
const char *path = luaL_checkstring(L, 1);
|
||||||
dir_data *d;
|
dir_data *d;
|
||||||
lua_pushcfunction(L, dir_iter);
|
lua_pushcfunction(L, dir_iter);
|
||||||
@@ -556,14 +712,21 @@ static int dir_iter_factory (lua_State *L) {
|
|||||||
if (d->dir == NULL)
|
if (d->dir == NULL)
|
||||||
luaL_error(L, "cannot open %s: %s", path, strerror(errno));
|
luaL_error(L, "cannot open %s: %s", path, strerror(errno));
|
||||||
#endif
|
#endif
|
||||||
|
#if LUA_VERSION_NUM >= 504
|
||||||
|
lua_pushnil(L);
|
||||||
|
lua_pushvalue(L, -2);
|
||||||
|
return 4;
|
||||||
|
#else
|
||||||
return 2;
|
return 2;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Creates directory metatable.
|
** Creates directory metatable.
|
||||||
*/
|
*/
|
||||||
static int dir_create_meta (lua_State *L) {
|
static int dir_create_meta(lua_State * L)
|
||||||
|
{
|
||||||
luaL_newmetatable(L, DIR_METATABLE);
|
luaL_newmetatable(L, DIR_METATABLE);
|
||||||
|
|
||||||
/* Method table */
|
/* Method table */
|
||||||
@@ -577,6 +740,11 @@ static int dir_create_meta (lua_State *L) {
|
|||||||
lua_setfield(L, -2, "__index");
|
lua_setfield(L, -2, "__index");
|
||||||
lua_pushcfunction(L, dir_close);
|
lua_pushcfunction(L, dir_close);
|
||||||
lua_setfield(L, -2, "__gc");
|
lua_setfield(L, -2, "__gc");
|
||||||
|
|
||||||
|
#if LUA_VERSION_NUM >= 504
|
||||||
|
lua_pushcfunction(L, dir_close);
|
||||||
|
lua_setfield(L, -2, "__close");
|
||||||
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -584,7 +752,8 @@ static int dir_create_meta (lua_State *L) {
|
|||||||
/*
|
/*
|
||||||
** Creates lock metatable.
|
** Creates lock metatable.
|
||||||
*/
|
*/
|
||||||
static int lock_create_meta (lua_State *L) {
|
static int lock_create_meta(lua_State * L)
|
||||||
|
{
|
||||||
luaL_newmetatable(L, LOCK_METATABLE);
|
luaL_newmetatable(L, LOCK_METATABLE);
|
||||||
|
|
||||||
/* Method table */
|
/* Method table */
|
||||||
@@ -600,36 +769,15 @@ static int lock_create_meta (lua_State *L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
#ifndef S_ISDIR
|
|
||||||
#define S_ISDIR(mode) (mode&_S_IFDIR)
|
|
||||||
#endif
|
|
||||||
#ifndef S_ISREG
|
|
||||||
#define S_ISREG(mode) (mode&_S_IFREG)
|
|
||||||
#endif
|
|
||||||
#ifndef S_ISLNK
|
|
||||||
#define S_ISLNK(mode) (0)
|
|
||||||
#endif
|
|
||||||
#ifndef S_ISSOCK
|
|
||||||
#define S_ISSOCK(mode) (0)
|
|
||||||
#endif
|
|
||||||
#ifndef S_ISFIFO
|
|
||||||
#define S_ISFIFO(mode) (0)
|
|
||||||
#endif
|
|
||||||
#ifndef S_ISCHR
|
|
||||||
#define S_ISCHR(mode) (mode&_S_IFCHR)
|
|
||||||
#endif
|
|
||||||
#ifndef S_ISBLK
|
|
||||||
#define S_ISBLK(mode) (0)
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
/*
|
/*
|
||||||
** Convert the inode protection mode to a string.
|
** Convert the inode protection mode to a string.
|
||||||
*/
|
*/
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
static const char *mode2string (unsigned short mode) {
|
static const char *mode2string(unsigned short mode)
|
||||||
|
{
|
||||||
#else
|
#else
|
||||||
static const char *mode2string (mode_t mode) {
|
static const char *mode2string(mode_t mode)
|
||||||
|
{
|
||||||
#endif
|
#endif
|
||||||
if (S_ISREG(mode))
|
if (S_ISREG(mode))
|
||||||
return "file";
|
return "file";
|
||||||
@@ -656,7 +804,8 @@ static const char *mode2string (mode_t mode) {
|
|||||||
** @param #2 Access time in seconds, current time is used if missing.
|
** @param #2 Access time in seconds, current time is used if missing.
|
||||||
** @param #3 Modification time in seconds, access time is used if missing.
|
** @param #3 Modification time in seconds, access time is used if missing.
|
||||||
*/
|
*/
|
||||||
static int file_utime (lua_State *L) {
|
static int file_utime(lua_State * L)
|
||||||
|
{
|
||||||
const char *file = luaL_checkstring(L, 1);
|
const char *file = luaL_checkstring(L, 1);
|
||||||
struct utimbuf utb, *buf;
|
struct utimbuf utb, *buf;
|
||||||
|
|
||||||
@@ -673,56 +822,81 @@ static int file_utime (lua_State *L) {
|
|||||||
|
|
||||||
|
|
||||||
/* inode protection mode */
|
/* inode protection mode */
|
||||||
static void push_st_mode (lua_State *L, STAT_STRUCT *info) {
|
static void push_st_mode(lua_State * L, STAT_STRUCT * info)
|
||||||
|
{
|
||||||
lua_pushstring(L, mode2string(info->st_mode));
|
lua_pushstring(L, mode2string(info->st_mode));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* device inode resides on */
|
/* device inode resides on */
|
||||||
static void push_st_dev (lua_State *L, STAT_STRUCT *info) {
|
static void push_st_dev(lua_State * L, STAT_STRUCT * info)
|
||||||
|
{
|
||||||
lua_pushinteger(L, (lua_Integer) info->st_dev);
|
lua_pushinteger(L, (lua_Integer) info->st_dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* inode's number */
|
/* inode's number */
|
||||||
static void push_st_ino (lua_State *L, STAT_STRUCT *info) {
|
static void push_st_ino(lua_State * L, STAT_STRUCT * info)
|
||||||
|
{
|
||||||
lua_pushinteger(L, (lua_Integer) info->st_ino);
|
lua_pushinteger(L, (lua_Integer) info->st_ino);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* number of hard links to the file */
|
/* number of hard links to the file */
|
||||||
static void push_st_nlink (lua_State *L, STAT_STRUCT *info) {
|
static void push_st_nlink(lua_State * L, STAT_STRUCT * info)
|
||||||
|
{
|
||||||
lua_pushinteger(L, (lua_Integer) info->st_nlink);
|
lua_pushinteger(L, (lua_Integer) info->st_nlink);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* user-id of owner */
|
/* user-id of owner */
|
||||||
static void push_st_uid (lua_State *L, STAT_STRUCT *info) {
|
static void push_st_uid(lua_State * L, STAT_STRUCT * info)
|
||||||
|
{
|
||||||
lua_pushinteger(L, (lua_Integer) info->st_uid);
|
lua_pushinteger(L, (lua_Integer) info->st_uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* group-id of owner */
|
/* group-id of owner */
|
||||||
static void push_st_gid (lua_State *L, STAT_STRUCT *info) {
|
static void push_st_gid(lua_State * L, STAT_STRUCT * info)
|
||||||
|
{
|
||||||
lua_pushinteger(L, (lua_Integer) info->st_gid);
|
lua_pushinteger(L, (lua_Integer) info->st_gid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* device type, for special file inode */
|
/* device type, for special file inode */
|
||||||
static void push_st_rdev (lua_State *L, STAT_STRUCT *info) {
|
static void push_st_rdev(lua_State * L, STAT_STRUCT * info)
|
||||||
|
{
|
||||||
lua_pushinteger(L, (lua_Integer) info->st_rdev);
|
lua_pushinteger(L, (lua_Integer) info->st_rdev);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* time of last access */
|
/* time of last access */
|
||||||
static void push_st_atime (lua_State *L, STAT_STRUCT *info) {
|
static void push_st_atime(lua_State * L, STAT_STRUCT * info)
|
||||||
|
{
|
||||||
lua_pushinteger(L, (lua_Integer) info->st_atime);
|
lua_pushinteger(L, (lua_Integer) info->st_atime);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* time of last data modification */
|
/* time of last data modification */
|
||||||
static void push_st_mtime (lua_State *L, STAT_STRUCT *info) {
|
static void push_st_mtime(lua_State * L, STAT_STRUCT * info)
|
||||||
|
{
|
||||||
lua_pushinteger(L, (lua_Integer) info->st_mtime);
|
lua_pushinteger(L, (lua_Integer) info->st_mtime);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* time of last file status change */
|
/* time of last file status change */
|
||||||
static void push_st_ctime (lua_State *L, STAT_STRUCT *info) {
|
static void push_st_ctime(lua_State * L, STAT_STRUCT * info)
|
||||||
|
{
|
||||||
lua_pushinteger(L, (lua_Integer) info->st_ctime);
|
lua_pushinteger(L, (lua_Integer) info->st_ctime);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* file size, in bytes */
|
/* file size, in bytes */
|
||||||
static void push_st_size (lua_State *L, STAT_STRUCT *info) {
|
static void push_st_size(lua_State * L, STAT_STRUCT * info)
|
||||||
|
{
|
||||||
lua_pushinteger(L, (lua_Integer) info->st_size);
|
lua_pushinteger(L, (lua_Integer) info->st_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
/* blocks allocated for file */
|
/* blocks allocated for file */
|
||||||
static void push_st_blocks (lua_State *L, STAT_STRUCT *info) {
|
static void push_st_blocks(lua_State * L, STAT_STRUCT * info)
|
||||||
|
{
|
||||||
lua_pushinteger(L, (lua_Integer) info->st_blocks);
|
lua_pushinteger(L, (lua_Integer) info->st_blocks);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* optimal file system I/O blocksize */
|
/* optimal file system I/O blocksize */
|
||||||
static void push_st_blksize (lua_State *L, STAT_STRUCT *info) {
|
static void push_st_blksize(lua_State * L, STAT_STRUCT * info)
|
||||||
|
{
|
||||||
lua_pushinteger(L, (lua_Integer) info->st_blksize);
|
lua_pushinteger(L, (lua_Integer) info->st_blksize);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -732,38 +906,61 @@ static void push_st_blksize (lua_State *L, STAT_STRUCT *info) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
static const char *perm2string (unsigned short mode) {
|
static const char *perm2string(unsigned short mode)
|
||||||
|
{
|
||||||
static char perms[10] = "---------";
|
static char perms[10] = "---------";
|
||||||
int i;
|
int i;
|
||||||
for (i=0;i<9;i++) perms[i]='-';
|
for (i = 0; i < 9; i++)
|
||||||
if (mode & _S_IREAD)
|
perms[i] = '-';
|
||||||
{ perms[0] = 'r'; perms[3] = 'r'; perms[6] = 'r'; }
|
if (mode & _S_IREAD) {
|
||||||
if (mode & _S_IWRITE)
|
perms[0] = 'r';
|
||||||
{ perms[1] = 'w'; perms[4] = 'w'; perms[7] = 'w'; }
|
perms[3] = 'r';
|
||||||
if (mode & _S_IEXEC)
|
perms[6] = 'r';
|
||||||
{ perms[2] = 'x'; perms[5] = 'x'; perms[8] = 'x'; }
|
}
|
||||||
|
if (mode & _S_IWRITE) {
|
||||||
|
perms[1] = 'w';
|
||||||
|
perms[4] = 'w';
|
||||||
|
perms[7] = 'w';
|
||||||
|
}
|
||||||
|
if (mode & _S_IEXEC) {
|
||||||
|
perms[2] = 'x';
|
||||||
|
perms[5] = 'x';
|
||||||
|
perms[8] = 'x';
|
||||||
|
}
|
||||||
return perms;
|
return perms;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
static const char *perm2string (mode_t mode) {
|
static const char *perm2string(mode_t mode)
|
||||||
|
{
|
||||||
static char perms[10] = "---------";
|
static char perms[10] = "---------";
|
||||||
int i;
|
int i;
|
||||||
for (i=0;i<9;i++) perms[i]='-';
|
for (i = 0; i < 9; i++)
|
||||||
if (mode & S_IRUSR) perms[0] = 'r';
|
perms[i] = '-';
|
||||||
if (mode & S_IWUSR) perms[1] = 'w';
|
if (mode & S_IRUSR)
|
||||||
if (mode & S_IXUSR) perms[2] = 'x';
|
perms[0] = 'r';
|
||||||
if (mode & S_IRGRP) perms[3] = 'r';
|
if (mode & S_IWUSR)
|
||||||
if (mode & S_IWGRP) perms[4] = 'w';
|
perms[1] = 'w';
|
||||||
if (mode & S_IXGRP) perms[5] = 'x';
|
if (mode & S_IXUSR)
|
||||||
if (mode & S_IROTH) perms[6] = 'r';
|
perms[2] = 'x';
|
||||||
if (mode & S_IWOTH) perms[7] = 'w';
|
if (mode & S_IRGRP)
|
||||||
if (mode & S_IXOTH) perms[8] = 'x';
|
perms[3] = 'r';
|
||||||
|
if (mode & S_IWGRP)
|
||||||
|
perms[4] = 'w';
|
||||||
|
if (mode & S_IXGRP)
|
||||||
|
perms[5] = 'x';
|
||||||
|
if (mode & S_IROTH)
|
||||||
|
perms[6] = 'r';
|
||||||
|
if (mode & S_IWOTH)
|
||||||
|
perms[7] = 'w';
|
||||||
|
if (mode & S_IXOTH)
|
||||||
|
perms[8] = 'x';
|
||||||
return perms;
|
return perms;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* permssions string */
|
/* permssions string */
|
||||||
static void push_st_perm (lua_State *L, STAT_STRUCT *info) {
|
static void push_st_perm(lua_State * L, STAT_STRUCT * info)
|
||||||
|
{
|
||||||
lua_pushstring(L, perm2string(info->st_mode));
|
lua_pushstring(L, perm2string(info->st_mode));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -797,14 +994,17 @@ struct _stat_members members[] = {
|
|||||||
/*
|
/*
|
||||||
** Get file or symbolic link information
|
** Get file or symbolic link information
|
||||||
*/
|
*/
|
||||||
static int _file_info_ (lua_State *L, int (*st)(const char*, STAT_STRUCT*)) {
|
static int _file_info_(lua_State * L,
|
||||||
|
int (*st)(const char *, STAT_STRUCT *))
|
||||||
|
{
|
||||||
STAT_STRUCT info;
|
STAT_STRUCT info;
|
||||||
const char *file = luaL_checkstring(L, 1);
|
const char *file = luaL_checkstring(L, 1);
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (st(file, &info)) {
|
if (st(file, &info)) {
|
||||||
lua_pushnil(L);
|
lua_pushnil(L);
|
||||||
lua_pushfstring(L, "cannot obtain information from file '%s': %s", file, strerror(errno));
|
lua_pushfstring(L, "cannot obtain information from file '%s': %s",
|
||||||
|
file, strerror(errno));
|
||||||
lua_pushinteger(L, errno);
|
lua_pushinteger(L, errno);
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
@@ -838,7 +1038,8 @@ static int _file_info_ (lua_State *L, int (*st)(const char*, STAT_STRUCT*)) {
|
|||||||
/*
|
/*
|
||||||
** Get file information using stat.
|
** Get file information using stat.
|
||||||
*/
|
*/
|
||||||
static int file_info (lua_State *L) {
|
static int file_info(lua_State * L)
|
||||||
|
{
|
||||||
return _file_info_(L, STAT_FUNC);
|
return _file_info_(L, STAT_FUNC);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -849,39 +1050,63 @@ static int file_info (lua_State *L) {
|
|||||||
** Returns 1 if successful (with the target on top of the stack),
|
** Returns 1 if successful (with the target on top of the stack),
|
||||||
** 0 on failure (with stack unchanged, and errno set).
|
** 0 on failure (with stack unchanged, and errno set).
|
||||||
*/
|
*/
|
||||||
static int push_link_target(lua_State *L) {
|
static int push_link_target(lua_State * L)
|
||||||
#ifdef _WIN32
|
{
|
||||||
errno = ENOSYS;
|
|
||||||
return 0;
|
|
||||||
#else
|
|
||||||
const char *file = luaL_checkstring(L, 1);
|
const char *file = luaL_checkstring(L, 1);
|
||||||
char *target = NULL;
|
#ifdef _WIN32
|
||||||
int tsize, size = 256; /* size = initial buffer capacity */
|
HANDLE h = CreateFile(file, GENERIC_READ,
|
||||||
while (1) {
|
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
|
||||||
target = realloc(target, size);
|
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||||
if (!target) /* failed to allocate */
|
if (h == INVALID_HANDLE_VALUE) {
|
||||||
return 0;
|
return lfs_win32_pusherror(L);
|
||||||
tsize = readlink(file, target, size);
|
|
||||||
if (tsize < 0) { /* a readlink() error occurred */
|
|
||||||
free(target);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
if (tsize < size)
|
#endif
|
||||||
|
char *target = NULL;
|
||||||
|
int tsize = 0, size = 256; /* size = initial buffer capacity */
|
||||||
|
int ok = 0;
|
||||||
|
while (!ok) {
|
||||||
|
char *target2 = (char *)realloc(target, size);
|
||||||
|
if (!target2) { /* failed to allocate */
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
target = target2;
|
||||||
|
#ifdef _WIN32
|
||||||
|
tsize = (int)GetFinalPathNameByHandle(h, target, size, FILE_NAME_OPENED);
|
||||||
|
#else
|
||||||
|
tsize = (int)readlink(file, target, size);
|
||||||
|
#endif
|
||||||
|
if (tsize < 0) { /* a readlink() error occurred */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (tsize < size) {
|
||||||
|
#ifdef _WIN32
|
||||||
|
if (tsize > 4 && strncmp(target, "\\\\?\\", 4) == 0) {
|
||||||
|
memmove(target, target + 4, tsize - 3);
|
||||||
|
tsize -= 4;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
ok = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
/* possibly truncated readlink() result, double size and retry */
|
/* possibly truncated readlink() result, double size and retry */
|
||||||
size *= 2;
|
size *= 2;
|
||||||
}
|
}
|
||||||
|
if (ok) {
|
||||||
target[tsize] = '\0';
|
target[tsize] = '\0';
|
||||||
lua_pushlstring(L, target, tsize);
|
lua_pushlstring(L, target, tsize);
|
||||||
free(target);
|
}
|
||||||
return 1;
|
#ifdef _WIN32
|
||||||
|
CloseHandle(h);
|
||||||
#endif
|
#endif
|
||||||
|
free(target);
|
||||||
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Get symbolic link information using lstat.
|
** Get symbolic link information using lstat.
|
||||||
*/
|
*/
|
||||||
static int link_info (lua_State *L) {
|
static int link_info(lua_State * L)
|
||||||
|
{
|
||||||
int ret;
|
int ret;
|
||||||
if (lua_isstring(L, 2) && (strcmp(lua_tostring(L, 2), "target") == 0)) {
|
if (lua_isstring(L, 2) && (strcmp(lua_tostring(L, 2), "target") == 0)) {
|
||||||
int ok = push_link_target(L);
|
int ok = push_link_target(L);
|
||||||
@@ -901,10 +1126,12 @@ static int link_info (lua_State *L) {
|
|||||||
/*
|
/*
|
||||||
** Assumes the table is on top of the stack.
|
** Assumes the table is on top of the stack.
|
||||||
*/
|
*/
|
||||||
static void set_info (lua_State *L) {
|
static void set_info(lua_State * L)
|
||||||
lua_pushliteral(L, "Copyright (C) 2003-2016 Kepler Project");
|
{
|
||||||
lua_setfield(L, -2, "_COPYRIGHT");
|
lua_pushliteral(L,
|
||||||
lua_pushliteral(L, "LuaFileSystem is a Lua library developed to complement the set of functions related to file systems offered by the standard Lua distribution");
|
"LuaFileSystem is a Lua library developed to complement "
|
||||||
|
"the set of functions related to file systems offered by "
|
||||||
|
"the standard Lua distribution");
|
||||||
lua_setfield(L, -2, "_DESCRIPTION");
|
lua_setfield(L, -2, "_DESCRIPTION");
|
||||||
lua_pushliteral(L, "LuaFileSystem " LFS_VERSION);
|
lua_pushliteral(L, "LuaFileSystem " LFS_VERSION);
|
||||||
lua_setfield(L, -2, "_VERSION");
|
lua_setfield(L, -2, "_VERSION");
|
||||||
@@ -928,10 +1155,11 @@ static const struct luaL_Reg fslib[] = {
|
|||||||
{ NULL, NULL },
|
{ NULL, NULL },
|
||||||
};
|
};
|
||||||
|
|
||||||
LFS_EXPORT int luaopen_lfs (lua_State *L) {
|
LFS_EXPORT int luaopen_lfs(lua_State * L)
|
||||||
|
{
|
||||||
dir_create_meta(L);
|
dir_create_meta(L);
|
||||||
lock_create_meta(L);
|
lock_create_meta(L);
|
||||||
luaL_newlib (L, fslib);
|
new_lib(L, fslib);
|
||||||
lua_pushvalue(L, -1);
|
lua_pushvalue(L, -1);
|
||||||
lua_setglobal(L, LFS_LIBNAME);
|
lua_setglobal(L, LFS_LIBNAME);
|
||||||
set_info(L);
|
set_info(L);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
LIBRARY lfs.dll
|
LIBRARY lfs.dll
|
||||||
VERSION 1.6
|
VERSION 1.9
|
||||||
EXPORTS
|
EXPORTS
|
||||||
luaopen_lfs
|
luaopen_lfs
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
** LuaFileSystem
|
** LuaFileSystem
|
||||||
** Copyright Kepler Project 2003 - 2016 (http://keplerproject.github.io/luafilesystem)
|
** File system manipulation library
|
||||||
|
**
|
||||||
|
** Copyright (C) 2003-2010 Kepler Project.
|
||||||
|
** Copyright (C) 2010-2022 The LuaFileSystem authors.
|
||||||
|
** (http://lunarmodules.github.io/luafilesystem)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Define 'chdir' for systems that do not implement it */
|
/* Define 'chdir' for systems that do not implement it */
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ local tmp = "/tmp"
|
|||||||
local sep = string.match (package.config, "[^\n]+")
|
local sep = string.match (package.config, "[^\n]+")
|
||||||
local upper = ".."
|
local upper = ".."
|
||||||
|
|
||||||
|
local is_unix = package.config:sub(1,1) == "/"
|
||||||
|
|
||||||
local lfs = require"lfs"
|
local lfs = require"lfs"
|
||||||
print (lfs._VERSION)
|
print (lfs._VERSION)
|
||||||
|
|
||||||
@@ -60,6 +62,8 @@ if not attrib then
|
|||||||
error ("could not get attributes of file `"..tmpdir.."':\n"..errmsg)
|
error ("could not get attributes of file `"..tmpdir.."':\n"..errmsg)
|
||||||
end
|
end
|
||||||
local f = io.open(tmpfile, "w")
|
local f = io.open(tmpfile, "w")
|
||||||
|
local data = "hello, file!"
|
||||||
|
f:write(data)
|
||||||
f:close()
|
f:close()
|
||||||
|
|
||||||
io.write(".")
|
io.write(".")
|
||||||
@@ -87,14 +91,42 @@ assert (new_att.modification == testdate1, "could not set modification time")
|
|||||||
io.write(".")
|
io.write(".")
|
||||||
io.flush()
|
io.flush()
|
||||||
|
|
||||||
-- Checking link (does not work on Windows)
|
|
||||||
if lfs.link (tmpfile, "_a_link_for_test_", true) then
|
if lfs.link (tmpfile, "_a_link_for_test_", true) then
|
||||||
assert (lfs.attributes"_a_link_for_test_".mode == "file")
|
assert (lfs.attributes"_a_link_for_test_".mode == "file")
|
||||||
assert (lfs.symlinkattributes"_a_link_for_test_".mode == "link")
|
assert (lfs.symlinkattributes"_a_link_for_test_".mode == "link")
|
||||||
assert (lfs.symlinkattributes"_a_link_for_test_".target == tmpfile)
|
assert (lfs.symlinkattributes"_a_link_for_test_".target == tmpfile)
|
||||||
assert (lfs.symlinkattributes("_a_link_for_test_", "target") == tmpfile)
|
assert (lfs.symlinkattributes("_a_link_for_test_", "target") == tmpfile)
|
||||||
|
|
||||||
|
assert (lfs.symlinkattributes(tmpfile).mode == "file")
|
||||||
|
|
||||||
assert (lfs.link (tmpfile, "_a_hard_link_for_test_"))
|
assert (lfs.link (tmpfile, "_a_hard_link_for_test_"))
|
||||||
|
assert (lfs.symlinkattributes"_a_hard_link_for_test_".mode == "file")
|
||||||
|
|
||||||
|
local fd = io.open(tmpfile)
|
||||||
|
assert(fd:read("*a") == data)
|
||||||
|
fd:close()
|
||||||
|
|
||||||
|
fd = io.open("_a_link_for_test_")
|
||||||
|
assert(fd:read("*a") == data)
|
||||||
|
fd:close()
|
||||||
|
|
||||||
|
fd = io.open("_a_hard_link_for_test_")
|
||||||
|
assert(fd:read("*a") == data)
|
||||||
|
fd:close()
|
||||||
|
|
||||||
|
fd = io.open("_a_hard_link_for_test_", "w+")
|
||||||
|
local data2 = "write in hard link"
|
||||||
|
fd:write(data2)
|
||||||
|
fd:close()
|
||||||
|
|
||||||
|
fd = io.open(tmpfile)
|
||||||
|
assert(fd:read("*a") == data2)
|
||||||
|
fd:close()
|
||||||
|
|
||||||
|
if is_unix then
|
||||||
assert (lfs.attributes (tmpfile, "nlink") == 2)
|
assert (lfs.attributes (tmpfile, "nlink") == 2)
|
||||||
|
end
|
||||||
|
|
||||||
assert (os.remove"_a_link_for_test_")
|
assert (os.remove"_a_link_for_test_")
|
||||||
assert (os.remove"_a_hard_link_for_test_")
|
assert (os.remove"_a_hard_link_for_test_")
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
LIBRARY lfs.dll
|
|
||||||
DESCRIPTION "LuaFileSystem"
|
|
||||||
VERSION 1.2
|
|
||||||
EXPORTS
|
|
||||||
luaopen_lfs
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
|
||||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
Project: "luafilesystem_dll"=.\luafilesystem_dll.dsp - Package Owner=<4>
|
|
||||||
|
|
||||||
Package=<5>
|
|
||||||
{{{
|
|
||||||
begin source code control
|
|
||||||
luafilesystem
|
|
||||||
..
|
|
||||||
end source code control
|
|
||||||
}}}
|
|
||||||
|
|
||||||
Package=<4>
|
|
||||||
{{{
|
|
||||||
}}}
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
Global:
|
|
||||||
|
|
||||||
Package=<5>
|
|
||||||
{{{
|
|
||||||
}}}
|
|
||||||
|
|
||||||
Package=<3>
|
|
||||||
{{{
|
|
||||||
}}}
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
@@ -1,127 +0,0 @@
|
|||||||
# Microsoft Developer Studio Project File - Name="luafilesystem_dll" - Package Owner=<4>
|
|
||||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
|
||||||
# ** DO NOT EDIT **
|
|
||||||
|
|
||||||
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
|
|
||||||
|
|
||||||
CFG=luafilesystem_dll - Win32 Debug
|
|
||||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
|
||||||
!MESSAGE use the Export Makefile command and run
|
|
||||||
!MESSAGE
|
|
||||||
!MESSAGE NMAKE /f "luafilesystem_dll.mak".
|
|
||||||
!MESSAGE
|
|
||||||
!MESSAGE You can specify a configuration when running NMAKE
|
|
||||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
|
||||||
!MESSAGE
|
|
||||||
!MESSAGE NMAKE /f "luafilesystem_dll.mak" CFG="luafilesystem_dll - Win32 Debug"
|
|
||||||
!MESSAGE
|
|
||||||
!MESSAGE Possible choices for configuration are:
|
|
||||||
!MESSAGE
|
|
||||||
!MESSAGE "luafilesystem_dll - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
|
|
||||||
!MESSAGE "luafilesystem_dll - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
|
|
||||||
!MESSAGE
|
|
||||||
|
|
||||||
# Begin Project
|
|
||||||
# PROP AllowPerConfigDependencies 0
|
|
||||||
# PROP Scc_ProjName "luafilesystem_dll"
|
|
||||||
# PROP Scc_LocalPath ".."
|
|
||||||
CPP=cl.exe
|
|
||||||
MTL=midl.exe
|
|
||||||
RSC=rc.exe
|
|
||||||
|
|
||||||
!IF "$(CFG)" == "luafilesystem_dll - Win32 Release"
|
|
||||||
|
|
||||||
# PROP BASE Use_MFC 0
|
|
||||||
# PROP BASE Use_Debug_Libraries 0
|
|
||||||
# PROP BASE Output_Dir "Release"
|
|
||||||
# PROP BASE Intermediate_Dir "Release"
|
|
||||||
# PROP BASE Target_Dir ""
|
|
||||||
# PROP Use_MFC 0
|
|
||||||
# PROP Use_Debug_Libraries 0
|
|
||||||
# PROP Output_Dir "../lib/vc6"
|
|
||||||
# PROP Intermediate_Dir "luafilesystem_dll/Release"
|
|
||||||
# PROP Ignore_Export_Lib 0
|
|
||||||
# PROP Target_Dir ""
|
|
||||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LUAFILESYSTEM_EXPORTS" /YX /FD /c
|
|
||||||
# ADD CPP /nologo /MD /W3 /GX /O2 /I "../../external-src/lua50/include" /I "../../compat/src" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LUAFILESYSTEM_EXPORTS" /YX /FD /c
|
|
||||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
|
||||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
|
||||||
# ADD BASE RSC /l 0x416 /d "NDEBUG"
|
|
||||||
# ADD RSC /l 0x416 /d "NDEBUG"
|
|
||||||
BSC32=bscmake.exe
|
|
||||||
# ADD BASE BSC32 /nologo
|
|
||||||
# ADD BSC32 /nologo
|
|
||||||
LINK32=link.exe
|
|
||||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
|
|
||||||
# ADD LINK32 lua50.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"../bin/vc6/lfs.dll" /libpath:"../../external-src/lua50/lib/dll"
|
|
||||||
# Begin Special Build Tool
|
|
||||||
SOURCE="$(InputPath)"
|
|
||||||
PostBuild_Cmds=cd ../bin/vc6 zip.exe luafilesystem-1.2-win32.zip lfs.dll
|
|
||||||
# End Special Build Tool
|
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "luafilesystem_dll - Win32 Debug"
|
|
||||||
|
|
||||||
# PROP BASE Use_MFC 0
|
|
||||||
# PROP BASE Use_Debug_Libraries 1
|
|
||||||
# PROP BASE Output_Dir "Debug"
|
|
||||||
# PROP BASE Intermediate_Dir "Debug"
|
|
||||||
# PROP BASE Target_Dir ""
|
|
||||||
# PROP Use_MFC 0
|
|
||||||
# PROP Use_Debug_Libraries 1
|
|
||||||
# PROP Output_Dir "../lib/vc6"
|
|
||||||
# PROP Intermediate_Dir "luafilesystem_dll/Debug"
|
|
||||||
# PROP Ignore_Export_Lib 0
|
|
||||||
# PROP Target_Dir ""
|
|
||||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LUAFILESYSTEM_EXPORTS" /YX /FD /GZ /c
|
|
||||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../external-src/lua50/include" /I "../../compat/src" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LUAFILESYSTEM_EXPORTS" /YX /FD /GZ /c
|
|
||||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
|
||||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
|
||||||
# ADD BASE RSC /l 0x416 /d "_DEBUG"
|
|
||||||
# ADD RSC /l 0x416 /d "_DEBUG"
|
|
||||||
BSC32=bscmake.exe
|
|
||||||
# ADD BASE BSC32 /nologo
|
|
||||||
# ADD BSC32 /nologo
|
|
||||||
LINK32=link.exe
|
|
||||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
|
|
||||||
# ADD LINK32 lua50.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"../bin/vc6/lfsd.dll" /pdbtype:sept /libpath:"../../external-src/lua50/lib/dll"
|
|
||||||
|
|
||||||
!ENDIF
|
|
||||||
|
|
||||||
# Begin Target
|
|
||||||
|
|
||||||
# Name "luafilesystem_dll - Win32 Release"
|
|
||||||
# Name "luafilesystem_dll - Win32 Debug"
|
|
||||||
# Begin Group "Source Files"
|
|
||||||
|
|
||||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE="..\..\compat\src\compat-5.1.c"
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=..\src\lfs.c
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\lfs.def
|
|
||||||
# End Source File
|
|
||||||
# End Group
|
|
||||||
# Begin Group "Header Files"
|
|
||||||
|
|
||||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE="..\..\compat\src\compat-5.1.h"
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=..\src\lfs.h
|
|
||||||
# End Source File
|
|
||||||
# End Group
|
|
||||||
# Begin Group "Resource Files"
|
|
||||||
|
|
||||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
|
||||||
# End Group
|
|
||||||
# End Target
|
|
||||||
# End Project
|
|
||||||
Reference in New Issue
Block a user