Jump to content




Compress - Transform a folder structure into a single self-extracting file!



47 replies to this topic

#1 Creator

    Mad Dash Victor

  • Members
  • 2,168 posts
  • LocationYou will never find me, muhahahahahaha

Posted 29 March 2015 - 09:09 PM

Compress


Have you ever wanted to distribute a program made up of more than one file? (Pretend you did)

Are you tired of long download times because you have to download 30 files? (Of course!)

Now there is a simple solution. (Show us please!)

It is called Compress! (So original!)


Compress is a script I developed to be able to distribute TheOS. Since I think it is fairly useful (I swear it is), I decided to publish it. With this piece of magic you can transform a whole folder structure into a single file only in a matter of seconds.

Features:

- Creating a self extracting file from a whole folder structure!
- Ignoring files.
- And soon, compression!

Usage:

Compressing:

Compress FolderToCompress DestinationFile MetadataFilePath

The 3rd argument is the path to the file holding the path of files/folders that have to be ignored. Each path has to be on a new line.

Extracting:

TheFileItWasCompressedTo DestinationFolder

Example:

Compress TheOS TheOS.file

TheOS.file TheOS

Download:

pastebin get 1rQJ9wC7 Compress

OR

1rQJ9wC7


Don't forget to comment and report any bugs!

I hope you enjoy this little handy script!

~Creator

Edited by Creator, 05 November 2015 - 10:08 PM.


#2 Creator

    Mad Dash Victor

  • Members
  • 2,168 posts
  • LocationYou will never find me, muhahahahahaha

Posted 07 April 2015 - 10:40 PM

Big update:
- Prints whatever it does, download to see what I mean by this vague statement.

#3 Dahknee

  • Members
  • 1,808 posts
  • Location/home/da

Posted 10 April 2015 - 01:25 PM

View PostCreator, on 07 April 2015 - 10:40 PM, said:

Big update:
- Prints whatever it does, download to see what I mean by this vague statement.

Yeah just tried it and it errored when trying to decompress...

#4 Creator

    Mad Dash Victor

  • Members
  • 2,168 posts
  • LocationYou will never find me, muhahahahahaha

Posted 10 April 2015 - 01:28 PM

View PostDannySMc, on 10 April 2015 - 01:25 PM, said:

View PostCreator, on 07 April 2015 - 10:40 PM, said:

Big update:
- Prints whatever it does, download to see what I mean by this vague statement.

Yeah just tried it and it errored when trying to decompress...

What folder did you compress. I retested it 5 mins ago and it worked like a charm.

Oh you have to provide an argument about where to unpack it. ;)

#5 Dahknee

  • Members
  • 1,808 posts
  • Location/home/da

Posted 10 April 2015 - 01:30 PM

I tried to compress a folder... but when I did it errored :/

#6 Creator

    Mad Dash Victor

  • Members
  • 2,168 posts
  • LocationYou will never find me, muhahahahahaha

Posted 10 April 2015 - 01:31 PM

What is the error?

Compressing works like this

Compress inputFolder outputFile

Edited by Creator, 10 April 2015 - 01:31 PM.


#7 Dahknee

  • Members
  • 1,808 posts
  • Location/home/da

Posted 10 April 2015 - 01:36 PM

Attempt to index local 'file' (a nil value)

I do understand how it works I am saying it didn't work even when I did it correctly?:(

#8 Creator

    Mad Dash Victor

  • Members
  • 2,168 posts
  • LocationYou will never find me, muhahahahahaha

Posted 10 April 2015 - 01:39 PM

Is there a line number that could help me fix the bug? ;)

#9 Dahknee

  • Members
  • 1,808 posts
  • Location/home/da

Posted 10 April 2015 - 01:48 PM

View PostCreator, on 10 April 2015 - 01:39 PM, said:

Is there a line number that could help me fix the bug? ;)/>

How would a line number help you if the program is dynamic and compressed with the contents of what I stored in?:ssss

Also this is the code that errored.
local function writeFile(path,content)
	local file = fs.open(path,"w")
	file.write(content)
	file.close()
end

View PostCreator, on 29 March 2015 - 09:09 PM, said:

Copress! (So original!)

You spelt it wrong.

Edited by DannySMc, 10 April 2015 - 01:45 PM.


#10 Creator

    Mad Dash Victor

  • Members
  • 2,168 posts
  • LocationYou will never find me, muhahahahahaha

Posted 10 April 2015 - 01:51 PM

Could you show me exactly what you did, so I can see what is wrong. I just retried it and it worked again. Maybe try re downloading it.

#11 Dahknee

  • Members
  • 1,808 posts
  • Location/home/da

Posted 10 April 2015 - 01:59 PM

So I compressed the rom using:
compress rom newrom
after it was done I then did:
newrom roma
it errored, also make sure to add a code which stops anyone if they don't put in ALL the arguments...
but the error was:
[string "newrom"]:19913: unexpected symbol near 'repeat'


#12 Creator

    Mad Dash Victor

  • Members
  • 2,168 posts
  • LocationYou will never find me, muhahahahahaha

Posted 10 April 2015 - 02:03 PM

I just did exaclty what you did, and it all worked. Could you post the version on Compress you are using on pastebin. It might allow me to trhow a look at it.

#13 Dahknee

  • Members
  • 1,808 posts
  • Location/home/da

Posted 10 April 2015 - 02:07 PM

I just re-downloaded it..? -.-

LINK

#14 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 10 April 2015 - 02:13 PM

I've got a hunch the "attempt to index nil" error stemmed from the system running out of disk space.

As for "compressing" rom, testing it myself, I find that 1) it seems to work and 2) the "compressed" script only has 11015 lines, as opposed to 19913.

There was a bug in textutils.serialise() where certain Lua keywords would be handled improperly if used as table key names. There's a "repeat" script in rom which would trigger this bug, but a fix was introduced by CC 1.7. I'm going to go out on a limb and say Danny needs to update his CC install.

#15 Creator

    Mad Dash Victor

  • Members
  • 2,168 posts
  • LocationYou will never find me, muhahahahahaha

Posted 10 April 2015 - 02:22 PM

Oh, I am using 1.6x so that may be the problem. ;)

#16 Dahknee

  • Members
  • 1,808 posts
  • Location/home/da

Posted 10 April 2015 - 02:26 PM

I am using 1.6 to test this, haven't used it on 1.7 yet...?

View PostBomb Bloke, on 10 April 2015 - 02:13 PM, said:

I've got a hunch the "attempt to index nil" error stemmed from the system running out of disk space.

As for "compressing" rom, testing it myself, I find that 1) it seems to work and 2) the "compressed" script only has 11015 lines, as opposed to 19913.

There was a bug in textutils.serialise() where certain Lua keywords would be handled improperly if used as table key names. There's a "repeat" script in rom which would trigger this bug, but a fix was introduced by CC 1.7. I'm going to go out on a limb and say Danny needs to update his CC install.

I am using an emulator but I can of course try it on my server when I am home! But I can't really use it if it isn't compatible between 1.6 and 1.7

#17 Creator

    Mad Dash Victor

  • Members
  • 2,168 posts
  • LocationYou will never find me, muhahahahahaha

Posted 10 April 2015 - 02:29 PM

Well, I think BombBloke gave a pretty accurate answer. Maybe I will try to work out a solution ;)

#18 Dahknee

  • Members
  • 1,808 posts
  • Location/home/da

Posted 10 April 2015 - 02:30 PM

Well if you do I can use it, if not then don't worry thanks.

#19 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 10 April 2015 - 03:15 PM

View PostCreator, on 10 April 2015 - 02:22 PM, said:

Oh, I am using 1.6x so that may be the problem. ;)

If that's the case, then it should be crashing for you too. :huh: Unless you're on one of the 1.66 betas...?

#20 Creator

    Mad Dash Victor

  • Members
  • 2,168 posts
  • LocationYou will never find me, muhahahahahaha

Posted 10 April 2015 - 05:27 PM

Oh, no sorry, it's 1.72 I am using. And it ain't crashing. Dunno why.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users