mirror of
https://github.com/LDDestroier/CC/
synced 2024-11-12 13:00:01 +00:00
Added -P and -R
Now you have to add -P to add the `progdor2.lua` file is added, and -R to allow read-only files/folders to be in archives.
This commit is contained in:
parent
b82df6741d
commit
ef41f2931c
19
progdor2.lua
19
progdor2.lua
@ -210,6 +210,8 @@ local argData = {
|
|||||||
["-PB"] = false, -- pastebin upload
|
["-PB"] = false, -- pastebin upload
|
||||||
["-t"] = false, -- transmit file
|
["-t"] = false, -- transmit file
|
||||||
["-r"] = false, -- receive file
|
["-r"] = false, -- receive file
|
||||||
|
["-R"] = false, -- include read-only files
|
||||||
|
["-P"] = false, -- include Progdor2 file
|
||||||
["-S"] = false, -- use skynet
|
["-S"] = false, -- use skynet
|
||||||
["-e"] = false, -- automatic self-extractor
|
["-e"] = false, -- automatic self-extractor
|
||||||
["-s"] = false, -- silent
|
["-s"] = false, -- silent
|
||||||
@ -240,6 +242,8 @@ local selfExtractor = argList["-e"] -- boolean
|
|||||||
local silent = argList["-s"] -- boolean
|
local silent = argList["-s"] -- boolean
|
||||||
local useCompression = argList["-c"] -- boolean
|
local useCompression = argList["-c"] -- boolean
|
||||||
local justOverwrite = argList["-o"] -- boolean
|
local justOverwrite = argList["-o"] -- boolean
|
||||||
|
local allowReadOnly = argList["-R"] -- boolean
|
||||||
|
local allowPackPD = argList["-P"] -- boolean
|
||||||
local useSkynet = argList["-S"] -- boolean
|
local useSkynet = argList["-S"] -- boolean
|
||||||
local trMode = argList["-t"] and "transmit" or (argList["-r"] and "receive" or "normal")
|
local trMode = argList["-t"] and "transmit" or (argList["-r"] and "receive" or "normal")
|
||||||
|
|
||||||
@ -288,8 +292,6 @@ local function showHelp(verboseHelp)
|
|||||||
if verboseHelp then
|
if verboseHelp then
|
||||||
helpInfo = {
|
helpInfo = {
|
||||||
"Progdor v" .. progdor.version,
|
"Progdor v" .. progdor.version,
|
||||||
"",
|
|
||||||
"Options:",
|
|
||||||
" -pb [pastebin ID] : Download from Pastebin.", -- added
|
" -pb [pastebin ID] : Download from Pastebin.", -- added
|
||||||
" -PB : Upload to pastebin.", -- added
|
" -PB : Upload to pastebin.", -- added
|
||||||
" -dd [download URL] : Download from URL.", -- added
|
" -dd [download URL] : Download from URL.", -- added
|
||||||
@ -298,6 +300,8 @@ local function showHelp(verboseHelp)
|
|||||||
" -S : Use skynet when transmitting/receiving.", -- added
|
" -S : Use skynet when transmitting/receiving.", -- added
|
||||||
" -t : Transmit a folder/file.", -- added
|
" -t : Transmit a folder/file.", -- added
|
||||||
" -r : Receive a file/packed folder.", -- added
|
" -r : Receive a file/packed folder.", -- added
|
||||||
|
" -R : Allow packing read-only files/folders.", -- added
|
||||||
|
" -P : Allow packing in Progdor2 itself.", -- added
|
||||||
" -a : Allows programs to use require() on Progdor.", -- added
|
" -a : Allows programs to use require() on Progdor.", -- added
|
||||||
" -c : Enables CCA compression.", -- added
|
" -c : Enables CCA compression.", -- added
|
||||||
" -m : Specify main executable file in archive.", -- added
|
" -m : Specify main executable file in archive.", -- added
|
||||||
@ -313,6 +317,7 @@ local function showHelp(verboseHelp)
|
|||||||
" progdor [options] inputFile (outputFolder)",
|
" progdor [options] inputFile (outputFolder)",
|
||||||
"",
|
"",
|
||||||
"Progdor is a file/folder packaging program with support for CCA compression and self-extraction.",
|
"Progdor is a file/folder packaging program with support for CCA compression and self-extraction.",
|
||||||
|
" If tacking on auto-extractor, a third argument will be the default extraction path.",
|
||||||
"",
|
"",
|
||||||
"Use -h for all options.",
|
"Use -h for all options.",
|
||||||
"",
|
"",
|
||||||
@ -393,6 +398,8 @@ local function listAll(path, includePath)
|
|||||||
local list = fs.list(path)
|
local list = fs.list(path)
|
||||||
local fc = fs.combine
|
local fc = fs.combine
|
||||||
for i = 1, #list do
|
for i = 1, #list do
|
||||||
|
if allowReadOnly or (not fs.isReadOnly(fc(path, list[i]))) then
|
||||||
|
if allowPackPD or fc(path, list[i]) ~= shell.getRunningProgram() then
|
||||||
if fs.isDir(fc(path, list[i])) then
|
if fs.isDir(fc(path, list[i])) then
|
||||||
if #fs.list(fc(path, list[i])) == 0 then
|
if #fs.list(fc(path, list[i])) == 0 then
|
||||||
output[#output+1] = (includePath and fc(path, list[i]) or list[i]) .. "/"
|
output[#output+1] = (includePath and fc(path, list[i]) or list[i]) .. "/"
|
||||||
@ -406,6 +413,8 @@ local function listAll(path, includePath)
|
|||||||
output[#output+1] = includePath and fc(path, list[i]) or list[i]
|
output[#output+1] = includePath and fc(path, list[i]) or list[i]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
return output
|
return output
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -413,6 +422,12 @@ local makeFileList = function(path, doCompress)
|
|||||||
local output = {}
|
local output = {}
|
||||||
local list = listAll(path, false)
|
local list = listAll(path, false)
|
||||||
local file
|
local file
|
||||||
|
if not allowPackPD then
|
||||||
|
cPrint("Ignoring Progdor2.", colors.lightGray)
|
||||||
|
end
|
||||||
|
if not allowReadOnly then
|
||||||
|
cPrint("Ignoring read-only files.", colors.lightGray)
|
||||||
|
end
|
||||||
sPrint("Packing files...")
|
sPrint("Packing files...")
|
||||||
for i = 1, #list do
|
for i = 1, #list do
|
||||||
setTextColor(colors.lightGray)
|
setTextColor(colors.lightGray)
|
||||||
|
Loading…
Reference in New Issue
Block a user