1
0
mirror of https://github.com/LDDestroier/CC/ synced 2024-11-08 19:09:58 +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:
LDDestroier 2020-03-25 20:55:15 -04:00 committed by GitHub
parent b82df6741d
commit ef41f2931c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -210,6 +210,8 @@ local argData = {
["-PB"] = false, -- pastebin upload
["-t"] = false, -- transmit file
["-r"] = false, -- receive file
["-R"] = false, -- include read-only files
["-P"] = false, -- include Progdor2 file
["-S"] = false, -- use skynet
["-e"] = false, -- automatic self-extractor
["-s"] = false, -- silent
@ -240,6 +242,8 @@ local selfExtractor = argList["-e"] -- boolean
local silent = argList["-s"] -- boolean
local useCompression = argList["-c"] -- boolean
local justOverwrite = argList["-o"] -- boolean
local allowReadOnly = argList["-R"] -- boolean
local allowPackPD = argList["-P"] -- boolean
local useSkynet = argList["-S"] -- boolean
local trMode = argList["-t"] and "transmit" or (argList["-r"] and "receive" or "normal")
@ -288,8 +292,6 @@ local function showHelp(verboseHelp)
if verboseHelp then
helpInfo = {
"Progdor v" .. progdor.version,
"",
"Options:",
" -pb [pastebin ID] : Download from Pastebin.", -- added
" -PB : Upload to pastebin.", -- added
" -dd [download URL] : Download from URL.", -- added
@ -298,6 +300,8 @@ local function showHelp(verboseHelp)
" -S : Use skynet when transmitting/receiving.", -- added
" -t : Transmit a folder/file.", -- 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
" -c : Enables CCA compression.", -- added
" -m : Specify main executable file in archive.", -- added
@ -313,6 +317,7 @@ local function showHelp(verboseHelp)
" progdor [options] inputFile (outputFolder)",
"",
"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.",
"",
@ -393,6 +398,8 @@ local function listAll(path, includePath)
local list = fs.list(path)
local fc = fs.combine
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.list(fc(path, list[i])) == 0 then
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]
end
end
end
end
return output
end
@ -413,6 +422,12 @@ local makeFileList = function(path, doCompress)
local output = {}
local list = listAll(path, false)
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...")
for i = 1, #list do
setTextColor(colors.lightGray)