summaryrefslogtreecommitdiff
path: root/platform/osx
diff options
context:
space:
mode:
Diffstat (limited to 'platform/osx')
-rw-r--r--platform/osx/dir_access_osx.h3
-rw-r--r--platform/osx/export/export.cpp21
-rw-r--r--platform/osx/os_osx.h3
-rw-r--r--platform/osx/os_osx.mm21
4 files changed, 24 insertions, 24 deletions
diff --git a/platform/osx/dir_access_osx.h b/platform/osx/dir_access_osx.h
index e1aa038c61..c5951a570e 100644
--- a/platform/osx/dir_access_osx.h
+++ b/platform/osx/dir_access_osx.h
@@ -41,9 +41,6 @@
#include "core/os/dir_access.h"
#include "drivers/unix/dir_access_unix.h"
-/**
- @author Juan Linietsky <reduzio@gmail.com>
-*/
class DirAccessOSX : public DirAccessUnix {
protected:
virtual String fix_unicode_name(const char *p_name) const;
diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp
index 8cabc45250..56b0a44dbc 100644
--- a/platform/osx/export/export.cpp
+++ b/platform/osx/export/export.cpp
@@ -29,9 +29,11 @@
/*************************************************************************/
#include "export.h"
+
#include "core/io/marshalls.h"
#include "core/io/resource_saver.h"
#include "core/io/zip_io.h"
+#include "core/os/dir_access.h"
#include "core/os/file_access.h"
#include "core/os/os.h"
#include "core/project_settings.h"
@@ -244,13 +246,17 @@ void EditorExportPlatformOSX::_make_icon(const Ref<Image> &p_icon, Vector<uint8_
copy->resize(icon_infos[i].size, icon_infos[i].size);
if (icon_infos[i].is_png) {
- //encode png icon
+ // Encode PNG icon.
it->create_from_image(copy);
String path = EditorSettings::get_singleton()->get_cache_dir().plus_file("icon.png");
ResourceSaver::save(path, it);
FileAccess *f = FileAccess::open(path, FileAccess::READ);
- ERR_FAIL_COND(!f);
+ if (!f) {
+ // Clean up generated file.
+ DirAccess::remove_file_or_error(path);
+ ERR_FAIL();
+ }
int ofs = data.size();
uint32_t len = f->get_len();
@@ -261,6 +267,10 @@ void EditorExportPlatformOSX::_make_icon(const Ref<Image> &p_icon, Vector<uint8_
len = BSWAP32(len);
copymem(&data.write[ofs], icon_infos[i].name, 4);
encode_uint32(len, &data.write[ofs + 4]);
+
+ // Clean up generated file.
+ DirAccess::remove_file_or_error(path);
+
} else {
PoolVector<uint8_t> src_data = copy->get_data();
@@ -561,7 +571,6 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
}
}
}
- //bleh?
}
if (data.size() > 0) {
@@ -687,7 +696,8 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
// Clean up temporary .app dir
OS::get_singleton()->move_to_trash(tmp_app_path_name);
- } else {
+
+ } else { // pck
String pack_path = EditorSettings::get_singleton()->get_cache_dir().plus_file(pkg_name + ".pck");
@@ -747,6 +757,9 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
zipCloseFileInZip(dst_pkg_zip);
}
}
+
+ // Clean up generated file.
+ DirAccess::remove_file_or_error(pack_path);
}
}
diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h
index a83d5084ed..9cb2915701 100644
--- a/platform/osx/os_osx.h
+++ b/platform/osx/os_osx.h
@@ -51,9 +51,6 @@
#include <CoreVideo/CoreVideo.h>
#undef CursorShape
-/**
- @author Juan Linietsky <reduzio@gmail.com>
-*/
class OS_OSX : public OS_Unix {
public:
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index 726882438b..ab77897b08 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -1599,6 +1599,7 @@ void OS_OSX::finalize() {
memdelete(joypad_osx);
memdelete(input);
+ cursors_cache.clear();
visual_server->finish();
memdelete(visual_server);
//memdelete(rasterizer);
@@ -1718,10 +1719,7 @@ Error OS_OSX::open_dynamic_library(const String p_path, void *&p_library_handle,
}
p_library_handle = dlopen(path.utf8().get_data(), RTLD_NOW);
- if (!p_library_handle) {
- ERR_EXPLAIN("Can't open dynamic library: " + p_path + ". Error: " + dlerror());
- ERR_FAIL_V(ERR_CANT_OPEN);
- }
+ ERR_FAIL_COND_V_MSG(!p_library_handle, ERR_CANT_OPEN, "Can't open dynamic library: " + p_path + ", error: " + dlerror() + ".");
return OK;
}
@@ -1961,15 +1959,10 @@ void OS_OSX::set_native_icon(const String &p_filename) {
memdelete(f);
NSData *icon_data = [[[NSData alloc] initWithBytes:&data.write[0] length:len] autorelease];
- if (!icon_data) {
- ERR_EXPLAIN("Error reading icon data");
- ERR_FAIL();
- }
+ ERR_FAIL_COND_MSG(!icon_data, "Error reading icon data.");
+
NSImage *icon = [[[NSImage alloc] initWithData:icon_data] autorelease];
- if (!icon) {
- ERR_EXPLAIN("Error loading icon");
- ERR_FAIL();
- }
+ ERR_FAIL_COND_MSG(!icon, "Error loading icon.");
[NSApp setApplicationIconImage:icon];
}
@@ -2410,7 +2403,7 @@ Size2 OS_OSX::get_min_window_size() const {
void OS_OSX::set_min_window_size(const Size2 p_size) {
if ((p_size != Size2()) && (max_size != Size2()) && ((p_size.x > max_size.x) || (p_size.y > max_size.y))) {
- WARN_PRINT("Minimum window size can't be larger than maximum window size!");
+ ERR_PRINT("Minimum window size can't be larger than maximum window size!");
return;
}
min_size = p_size;
@@ -2426,7 +2419,7 @@ void OS_OSX::set_min_window_size(const Size2 p_size) {
void OS_OSX::set_max_window_size(const Size2 p_size) {
if ((p_size != Size2()) && ((p_size.x < min_size.x) || (p_size.y < min_size.y))) {
- WARN_PRINT("Maximum window size can't be smaller than minimum window size!");
+ ERR_PRINT("Maximum window size can't be smaller than minimum window size!");
return;
}
max_size = p_size;