Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Tar Module - Extract tar files with Corona
Started by Danny Mar 12 2012 11:19 PM

- - - - -
68 replies to this topic
[TOPIC CONTROLS]
Page 3 of 3 1 2 3
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#51

Omnigeek Media

[GLOBAL: userInfoPane.html]
Omnigeek Media
  • Corona Geek

  • 2,975 posts
  • Corona SDK

ping.... anyone? Beuhler?
uid: 19626 topic_id: 23242 reply_id: 130930


[TOPIC: post.html]
#52

ezraanderson1979

[GLOBAL: userInfoPane.html]
ezraanderson1979
  • Contributor

  • 103 posts
  • Corona SDK

1. is it an umcompressed tar?
2. did you use this program for making the tar http://www.izarc.org/download.html
3. have your tried it from the temporary directory instead of the the cache folder?
4. have your tried the original tar.lua from danny, http://www.infuseddreams.com/apps/Tar_Lib.zip?
5. have you tried with out the subfolders?
6. maybe take out all non-abc characters from filenames.

if you want to post your tar file or an example of it i will try to duplicate your error.

it has always worked well for me on win sim, mac sim, ios,andriod. so i am unclear in what the problem might be.
uid: 89663 topic_id: 23242 reply_id: 131137


[TOPIC: post.html]
#53

Omnigeek Media

[GLOBAL: userInfoPane.html]
Omnigeek Media
  • Corona Geek

  • 2,975 posts
  • Corona SDK

1. is it an umcompressed tar?
Yes

2. did you use this program for making the tar http://www.izarc.org/download.html
No, I used the tar from the command line. I know that was mentioned as a problem, but I also was hoping it would have been addressed.

3. have your tried it from the temporary directory instead of the the cache folder?
No. But I'll give that a try, at least for the source folder. The un-tarred filed will have to go to Caches since Apple won't let me unpack downloaded content to Documents.

4. have your tried the original tar.lua from danny, http://www.infuseddreams.com/apps/Tar_Lib.zip?
No.

5. have you tried with out the subfolders?
If it wont' work with directories, I can't use this solution.

6. maybe take out all non-abc characters from filenames.
This is impractical as well.

Thanks for the suggestions.
uid: 19626 topic_id: 23242 reply_id: 131162


[TOPIC: post.html]
#54

Omnigeek Media

[GLOBAL: userInfoPane.html]
Omnigeek Media
  • Corona Geek

  • 2,975 posts
  • Corona SDK

Well I solved this problem. Seems that in tar.lua, it was setting a variable called "destDir" and it was only considering system.DocumentsDirectory and system.TemporaryDirectory as valid possibilities. I've expanded it to cover system.CachesDirectory and all is fine.

Now if it could just deal with compressed files....
uid: 19626 topic_id: 23242 reply_id: 131278


[TOPIC: post.html]
#55

ezraanderson1979

[GLOBAL: userInfoPane.html]
ezraanderson1979
  • Contributor

  • 103 posts
  • Corona SDK

@ rob

i am using 2012.894 public build.

i tried this last night https://github.com/mimetic/tar.lua.git with no success, on osx it appears to finish its processing but makes no files or directories. it never enters this line of code in tar.lua, all header.typeflag shows as a filename even if its a directory.

		if header.typeflag == "directory" then
		
		print('driectory')
			lfs.mkdir( pathname )


On xp there is the forward/backslashes issue with lfs, probably could replace all slashes in the file-path string but never got that far, i had to do this before with something else.

and at the moment i am not doing device builds.

i know its not ideal, but when i first used tar with corona it did not have directory support so i just prefix everything as the directory name that i wanted, it help with clutter a little bit, example:

images_lock,
images_bug,
music_backgrouund, 
sub1_datafile,
sub1_updatemenu,

I will look into it some more but maybe some others could tell us what corona builds they used, and the process they used to make their tar files for this to work successfully.

uid: 89663 topic_id: 23242 reply_id: 131280


[TOPIC: post.html]
#56

ezraanderson1979

[GLOBAL: userInfoPane.html]
ezraanderson1979
  • Contributor

  • 103 posts
  • Corona SDK

@ rob

sorry didn't read your post first. congrats on getting it to work.
uid: 89663 topic_id: 23242 reply_id: 131281


[TOPIC: post.html]
#57

Omnigeek Media

[GLOBAL: userInfoPane.html]
Omnigeek Media
  • Corona Geek

  • 2,975 posts
  • Corona SDK

Here is the output of "diff" if any one wants it:

154,155d153
< 	elseif destdir == system.CachesDirectory then
< 		destPath = system.pathForFile("", system.CachesDirectory)

I'm assuming both versions have this issue.

Rob
uid: 19626 topic_id: 23242 reply_id: 131291


[TOPIC: post.html]
#58

d3mac123

[GLOBAL: userInfoPane.html]
d3mac123
  • Contributor

  • 248 posts
  • Corona SDK

Rob, can you please share how to "tar" files from a command line on a Mac? do I need to install anything or is it a native feature on the macs?

thanks a lot,
Alex

*** I FOUND IT ***
However, having use the Terminal line to (uncompressed) tar my file:
tar -cvf test.tar /path

i am still getting an error while trying to untaring it. Ideas?

Taking advantage, is there a way to use the native tar from outside the Terminal window? I am thinking on a batch file or something.
uid: 4883 topic_id: 23242 reply_id: 134181


[TOPIC: post.html]
#59

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,779 posts
  • Enterprise

I've never worked with Mac automator scripts, but that's a possibility since it can execute commands.
uid: 199310 topic_id: 23242 reply_id: 134223


[TOPIC: post.html]
#60

s.n.r

[GLOBAL: userInfoPane.html]
s.n.r
  • Observer

  • 6 posts
  • Corona SDK

Does anyone want a paid job to implement this for me? My apk file size is just over 100MB and of the Android store only allows apks of 50MB. In all honesty how to implement this and make it work has gone over my head (I'm still new to this) so I've posted this job if anyone want a bit of spare change for implementing this for my app:

https://developer.coronalabs.com/forum/2012/12/19/paid-job-need-someone-help-me-get-my-100mb-app-android-app-store-possible-using

If anyone wants to provide a step by step guide even better, but either is welcome :)
uid: 187132 topic_id: 23242 reply_id: 135788


[TOPIC: post.html]
#61

iPlayalot

[GLOBAL: userInfoPane.html]
iPlayalot
  • Enthusiast

  • 65 posts
  • Corona SDK

update the code in tar.lua for using CachesDirectory
	if destdir == system.DocumentsDirectory then
		destPath = system.pathForFile("", system.DocumentsDirectory)
	elseif destdir == system.TemporaryDirectory then
		destPath = system.pathForFile("", system.TemporaryDirectory)
	elseif destdir == system.CachesDirectory then
		destPath = system.pathForFile("", system.CachesDirectory)
	else
		destPath = destdir
	end
uid: 96683 topic_id: 23242 reply_id: 138751


[TOPIC: post.html]
#62

Kritt

[GLOBAL: userInfoPane.html]
Kritt
  • Observer

  • 8 posts
  • Corona SDK

I have a question about Android Expansion Files. I know that this feature is not supported yet, but is it possible to somehow decompile apk file, add some code that is needed (http://developer.android.com/google/play/expansion-files.html) and compile it again or I need Corona Enterprise service to do that?

P.S
Tried https://github.com/mimetic/tar.lua.git and it worked when I created tar file with 7-zip and changed:
header.magic = 'ustar '-- block:sub(258,263)
header.version = '00'--block:sub(264,265)
Maybe 7-zip doesn't know how to add version and format name to file header but with code change everything works and untars even subdirectories.
I couldn't make it work with IZArc.
uid: 117071 topic_id: 23242 reply_id: 141105


[TOPIC: post.html]
#63

alberto1

[GLOBAL: userInfoPane.html]
alberto1
  • Contributor

  • 115 posts
  • Corona SDK

Hi,

I'm playing with this tar module (Thanks a lot Danny, ezraanderson1979, mimetic... Great job!!)
I download a .tar from server to the DocumentsDirectory and then try to untar the file.
In the mac simulator everything is ok but when I test in Android or iPad, the app crashes when untar is running.
If I try with .tar files about 10Mb (for example), works fine also in Android and iPad devices, but when I try with files about 500Mb (for example), the app crashes untaring.

Could anybody tell me if is there any limit for the tar file size?

TIA

Alberto.
uid: 44013 topic_id: 23242 reply_id: 142621


[TOPIC: post.html]
#64

TandG

[GLOBAL: userInfoPane.html]
TandG
  • Contributor

  • 422 posts
  • Corona SDK

This looks pretty handy! It would be perfect if we actually had a way to create .tar files from within the app as well.

Does anyone know if thats possible at all? I had a brief look but .tar files really aren't my forte.
uid: 69826 topic_id: 23242 reply_id: 142745


[TOPIC: post.html]
#65

TandG

[GLOBAL: userInfoPane.html]
TandG
  • Contributor

  • 422 posts
  • Corona SDK

This looks pretty handy! It would be perfect if we actually had a way to create .tar files from within the app as well.

Does anyone know if thats possible at all? I had a brief look but .tar files really aren't my forte.
uid: 69826 topic_id: 23242 reply_id: 142745


[TOPIC: post.html]
#66

emmanuel.ahkouen

[GLOBAL: userInfoPane.html]
emmanuel.ahkouen
  • Observer

  • 21 posts
  • Corona SDK

Hello everyone,

I'm also a little bit worried about the APK size. I checked the roadmap but I can't see anything about that. Is it already implemented ?
Or I have to use the tar module extraction ?

Thanks.
uid: 231311 topic_id: 23242 reply_id: 145730


[TOPIC: post.html]
#67

j.witczak

[GLOBAL: userInfoPane.html]
j.witczak
  • Observer

  • 12 posts
  • Corona SDK

Hello everyone,

 

when I use IZArc (windows), I get the following error:

Runtime error
    ...d4lg4lsxvm72xc7vm0000gp/T/TemporaryItems/193/tar.lua:147: attempt to index local 'file_handle' (a nil value )

With BetterZip it works.

 

Thank you for your help :)



[TOPIC: post.html]
#68

sergiogmaster

[GLOBAL: userInfoPane.html]
sergiogmaster
  • Observer

  • 3 posts
  • Corona SDK

Hi guys.

Does anyone have an idea how to compress multiple images within the app to send to a server? In my case, my app should compress some images for then send to the server.



[TOPIC: post.html]
#69

abhishekkumar.jain

[GLOBAL: userInfoPane.html]
abhishekkumar.jain
  • Observer

  • 7 posts
  • Corona SDK

Hi,

I have created tar file using following command:- 

 

tar cvf story4read.tar story4read/

 

this command generated a tar file, When I try to untar the tar file, I am getting this Error 

 

tar.lua:139: attempt to index local 'file_handle' (a nil value)
stack traceback:
[C]: ?
...ctionsRR/coronaPractice/TarfileExtractSample/tar.lua:139: in function 'untar'
...tionsRR/coronaPractice/TarfileExtractSample/main.lua:69: in function 'unTarAllFiles'
 
 
 
But when I create tar file with BetterZip , it is working properly.
So, Please let me know that, how can we create uncompressed tar file without "BetterZip". (or I have to buy BetterZip as its trial version already over). 
 
 
 
 
 
Edit:- After above commands, I made tar file from inside the directory
 
ttmacmini001:story4read abhishekkumar.jain$ tar cvf TAR.tar *.*
 
I used this command too 
ttmacmini001:story4read abhishekkumar.jain$ tar -cvf TAR.tar *.*
 
After that also, I'm facing problem but Error type is changed ,now I am getting following Error :- 
 
2014-05-01 11:57:09.255 Corona Simulator[521:707] Invalid header magic 
2014-05-01 11:57:09.255 Corona Simulator[521:707] Runtime error
...ctionsRR/coronaPractice/TarfileExtractSample/tar.lua:120: attempt to index local 'header' (a boolean value)
stack traceback:



[topic_controls]
Page 3 of 3 1 2 3
 
[/topic_controls]