Archived Forum Post

Index of archived forum posts


Unable to untar a tar.gz file

Jan 27 '16 at 15:18

Hi, I am unable to untar a tar.gz file following is mine code

CkoTar *tarTask = [[CkoTar alloc] init];
BOOL success = [gzip UnlockComponent: @"Anything for 30-day trial"];
if (success != YES) {
tarTask.UntarFromDir = utarFilePath;
BOOL success = [tarTask UntarGz:tarFilePath];
if (success != YES) {
    NSLog(@"Unxiped %@", tarTask.LastErrorText);

This is the error Log

Unxiped ChilkatLog: UntarGz: DllDate: Dec 30 2015 ChilkatVersion: UnlockPrefix: Anything for 30-day trial Architecture: Little Endian; 64-bit Language: IOS Objective-C VerboseLogging: 0 pathQP: Alfresco_Resources.tar.gz fopen_failed: errno: 2 osErrorMessage: No such file or directory Failed to open file. mode: r path: Alfresco_Resources.tar.gz --fopen_failed Failed to open file data source. --UntarGz --ChilkatLog

I have tried with both

tarTask.NoAbsolutePaths = YES & NO both.

Accepted Answer

When a filename with no path part is passed to a method requiring a file path, one cannot assume the file to be located anywhere except for the current working directory of the process. I don't know what that might be in iOS. The solution is to pass an absolute file path to the .tar.gz so there is no question about where the file is located.