@@ -201,15 +201,19 @@ + (int)run:(NOZCLIUnzipModeInfo *)info
201201 [op start ]; // will run synchronously
202202 NOZDecompressResult *result = op.result ;
203203 if (result.operationError ) {
204+ printf (" \n " );
204205 NOZCLI_printError (result.operationError );
205206 return -2 ;
206207 }
207208
208209 if (!result.didSucceed ) {
210+ printf (" \n " );
209211 printf (" FAILED!\n " );
210212 return -2 ;
211213 }
212214
215+ fprintf (stdout, " \r " );
216+ fflush (stdout);
213217 printf (" compression ratio: %f \n " , result.compressionRatio );
214218 return 0 ;
215219 }
@@ -228,8 +232,9 @@ + (int)run:(NOZCLIUnzipModeInfo *)info
228232 }
229233
230234 NOZProgressBlock progressBlock = ^(int64_t totalBytes, int64_t bytesComplete, int64_t bytesCompletedThisPass, BOOL *abort) {
231- // const double progress = (double)bytesComplete / (double)totalBytes;
232- // printf("%zi%%\n", (NSInteger)(progress * 100.));
235+ const double progress = (double )bytesComplete / (double )totalBytes;
236+ fprintf (stdout, " \r %li%% " , (long )progress);
237+ fflush (stdout);
233238 };
234239 NSFileManager *fm = [NSFileManager defaultManager ];
235240 NSString *tmpDir = [NSTemporaryDirectory () stringByAppendingPathComponent: [NSUUID UUID ].UUIDString];
@@ -251,9 +256,12 @@ + (int)run:(NOZCLIUnzipModeInfo *)info
251256
252257 if (![unzipper saveRecord: record toDirectory: tmpDir options: NOZUnzipperSaveRecordOptionIgnoreIntermediatePath progressBlock: progressBlock error: &error]) {
253258 [fm removeItemAtPath: tmpDir error: NULL ];
259+ printf (" \n " );
254260 NOZCLI_printError (error);
255261 return -2 ;
256262 }
263+ fprintf (stdout, " \r " );
264+ fflush (stdout);
257265
258266 NSString *tmpPath = [tmpDir stringByAppendingPathComponent: record.name.lastPathComponent];
259267 NSString *dstPath = entry.outputPath ?: [info.baseOutputPath stringByAppendingPathComponent: entry.entryName];
@@ -392,7 +400,7 @@ - (NSString *)description
392400
393401@implementation NOZCLIUnzipDecompressDelegate
394402{
395- NSInteger _lastProgress;
403+ long _lastProgress;
396404}
397405
398406- (void )decompressOperation : (NOZDecompressOperation *)op didCompleteWithResult : (NOZDecompressResult *)result
@@ -401,12 +409,13 @@ - (void)decompressOperation:(NOZDecompressOperation *)op didCompleteWithResult:(
401409
402410- (void )decompressOperation : (NOZDecompressOperation *)op didUpdateProgress : (float )progress
403411{
404- const NSInteger progressInt = (NSInteger )(progress * 100 .f );
412+ const long progressInt = (long )(progress * 100 .f );
405413 if (progressInt == _lastProgress) {
406414 return ;
407415 }
408416 _lastProgress = progressInt;
409- // printf("%zi%%\n", progressInt);
417+ fprintf (stdout, " \r %li%% " , progressInt);
418+ fflush (stdout);
410419}
411420
412421- (BOOL )shouldDecompressOperation : (NOZDecompressOperation *)op overwriteFileAtPath : (NSString *)path
0 commit comments