diff --git a/SConstruct b/SConstruct index a5e2b1e..eb74adb 100644 --- a/SConstruct +++ b/SConstruct @@ -76,6 +76,10 @@ env.Append( "gd_spritestudio/SpriteStudio6-SDK/Common/Helper", ] ) + +if env["platform"] == 'macos': + env.Append(LINKFLAGS=["-framework", "CoreFoundation"]) + # Set iOS minimum deployment target if env["platform"] == "ios": env.Append(CCFLAGS=["-miphoneos-version-min=12.0"]) @@ -89,7 +93,6 @@ sources.extend(Glob("gd_spritestudio/SpriteStudio6-SDK/Common/Helper/DebugPrint. sources.extend(Glob("gd_spritestudio/SpriteStudio6-SDK/Common/Helper/IsshTexture.cpp")) sources.extend(Glob("gd_spritestudio/SpriteStudio6-SDK/Common/Helper/stb_image.c")) - if env["target"] in ["editor", "template_debug"]: try: doc_data = env.GodotCPPDocData("src/gen/doc_data.gen.cpp", source=Glob("doc_classes/*.xml")) diff --git a/examples/feature_test_gdextension/project.godot b/examples/feature_test_gdextension/project.godot index b970ebc..1d10696 100644 --- a/examples/feature_test_gdextension/project.godot +++ b/examples/feature_test_gdextension/project.godot @@ -25,4 +25,5 @@ common/enable_pause_aware_picking=true [rendering] +textures/vram_compression/import_etc2_astc=true environment/defaults/default_environment="res://default_env.tres" diff --git a/gd_spritestudio/gd_io.cpp b/gd_spritestudio/gd_io.cpp index c6e8249..0fc40b9 100644 --- a/gd_spritestudio/gd_io.cpp +++ b/gd_spritestudio/gd_io.cpp @@ -31,24 +31,14 @@ String GdIO::loadStringFromFile( const String& strPath ) String str = String( "" ); #ifdef SPRITESTUDIO_GODOT_EXTENSION - Ref resFileAccess = FileAccess::open( strPath, FileAccess::READ); - err = resFileAccess->get_error(); - if ( err != OK ) { + str = FileAccess::get_file_as_string(strPath); + if (str.length() == 0) { + err = ERR_FILE_UNRECOGNIZED; ERR_PRINT( String( "loadStringFromFile error: " ) + String::num( err ) ); - if ( resFileAccess.is_valid() ) { - resFileAccess->close(); - } - return str; } - while ( !resFileAccess->eof_reached() ) { - str += resFileAccess->get_line(); - } - - resFileAccess->close(); - #endif #ifdef GD_V4 Ref resFileAccess = FileAccess::open( strPath, FileAccess::READ, &err ); @@ -96,14 +86,10 @@ Error GdIO::saveStringToFile( const String& strPath, const String& str ) #ifdef SPRITESTUDIO_GODOT_EXTENSION Ref resFileAccess = FileAccess::open( strPath, FileAccess::WRITE); - err = resFileAccess->get_error(); - if ( err != OK ) { + if ( !resFileAccess.is_valid() ) { + err = ERR_FILE_CANT_OPEN; ERR_PRINT( String( "saveStringToFile error: " ) + String::num( err ) ); - if ( resFileAccess.is_valid() ) { - resFileAccess->close(); - } - return err; } @@ -157,14 +143,9 @@ Variant GdIO::loadVariantFromFile( const String& strPath ) #ifdef SPRITESTUDIO_GODOT_EXTENSION Ref resFileAccess = FileAccess::open( strPath, FileAccess::READ); - err = resFileAccess->get_error(); - if ( err != OK ) { + if ( !resFileAccess.is_valid() ) { + err = ERR_FILE_CANT_OPEN; ERR_PRINT( String( "loadVariantFromFile error: " ) + String::num( err ) ); - - if ( resFileAccess.is_valid() ) { - resFileAccess->close(); - } - return val; } @@ -241,14 +222,10 @@ Error GdIO::saveVariantToFile( const String& strPath, const Variant& val ) #ifdef SPRITESTUDIO_GODOT_EXTENSION Ref resFileAccess = FileAccess::open( strPath, FileAccess::WRITE); - err = resFileAccess->get_error(); - if ( err != OK ) { + if ( !resFileAccess.is_valid() ) { + err = ERR_FILE_CANT_OPEN; ERR_PRINT( String( "saveVariantToFile error: " ) + String::num( err ) ); - if ( resFileAccess.is_valid() ) { - resFileAccess->close(); - } - return err; }