add zip archiver library to compress cubes exporter

This commit is contained in:
2018-06-15 22:45:28 +02:00
parent 559db7d8e9
commit ef5ef5d07e
23 changed files with 1526 additions and 0 deletions

View File

@@ -1263,6 +1263,9 @@ void ui::Canvas::export_anim(std::string data_path)
void ui::Canvas::export_cubes(std::string data_path)
{
#ifdef __OBJC__
NSMutableArray* files = [NSMutableArray array];
#endif
std::array<std::string, 6> names {
"pz", "px", "nz", "nx",
"py", "ny"
@@ -1322,9 +1325,20 @@ void ui::Canvas::export_cubes(std::string data_path)
NSLog(@"error saving to photos : %@", error);
}
}];
#endif
#ifdef __OBJC__
[files addObject:[NSString stringWithUTF8String : name]];
#endif
}
}
#ifdef __OBJC__
static char name[128];
sprintf(name, "%s.zip", data_path.c_str());
auto zip_path = [NSString stringWithUTF8String : name];
[SSZipArchive createZipFileAtPath:zip_path withFilesAtPaths:files];
for (NSString* f : files)
[[NSFileManager defaultManager] removeItemAtPath:f error:nil];
#endif
}
void ui::Canvas::project_save(std::string file_path)

View File

@@ -15,6 +15,7 @@
#import <AVFoundation/AVFoundation.h>
#import <UIKit/UIKit.h>
#import <GLKit/GLKit.h>
#import <ZipArchive/ZipArchive.h>
#endif
#include <OpenGLES/ES3/gl.h>
#include <OpenGLES/ES3/glext.h>
@@ -28,6 +29,7 @@
#import <AVFoundation/AVFoundation.h>
#import <UIKit/UIKit.h>
#import <GLKit/GLKit.h>
#import <ZipArchive/ZipArchive.h>
#endif
#include <OpenGLES/ES3/gl.h>
#include <OpenGLES/ES3/glext.h>
@@ -38,6 +40,7 @@
#ifdef __OBJC__
#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>
#import <ZipArchive/ZipArchive.h>
#endif
#include <OpenGL/gl3.h>
#include <OpenGL/gl3ext.h>