Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
22d52c4
commit 0a717ae
Showing
1 changed file
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
local miniz = require('miniz') | ||
local uv = require('uv') | ||
local pathJoin = require('luvi').path.join | ||
|
||
local reader = miniz.new_reader(uv.exepath()) | ||
for i = 1, reader:get_num_files() do | ||
local path = reader:get_filename(i) | ||
print(path) | ||
end | ||
|
||
-- Build a new luvi* binary given a list of zip files and/or folders. | ||
local function build(...) | ||
local files = {} | ||
local cwd = uv.cwd() | ||
local args = {...} | ||
|
||
for i = 1, #args do | ||
local path = pathJoin(cwd, args[i]) | ||
local stat = assert(uv.fs_stat(path)) | ||
if stat.type == "FILE" then | ||
local reader = miniz.new_reader(path) | ||
print("Importing zip file: " .. path) | ||
for j = 1, reader:get_num_files() do | ||
if not reader:is_directory(j) then | ||
local filename = reader:get_filename(j) | ||
print(" " .. filename) | ||
files[filename] = reader:extract(j) | ||
end | ||
end | ||
print() | ||
elseif stat.type == "DIRECTORY" then | ||
local function importFolder(path) | ||
local req = uv.fs_scandir(path) | ||
local function getNext() | ||
return uv.fs_scandir_next(req) | ||
end | ||
for path in do | ||
print(path) | ||
end | ||
end | ||
p(path, "FOLDER") | ||
importFolder(path) | ||
else | ||
error("Not sure how to embed " .. path) | ||
end | ||
endgit | ||
return files | ||
end | ||
|
||
build(uv.exepath(), "app") |