Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand All @@ -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"))
Expand Down
1 change: 1 addition & 0 deletions examples/feature_test_gdextension/project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -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"
41 changes: 9 additions & 32 deletions gd_spritestudio/gd_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,14 @@ String GdIO::loadStringFromFile( const String& strPath )
String str = String( "" );

#ifdef SPRITESTUDIO_GODOT_EXTENSION
Ref<FileAccess> 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<FileAccess> resFileAccess = FileAccess::open( strPath, FileAccess::READ, &err );
Expand Down Expand Up @@ -96,14 +86,10 @@ Error GdIO::saveStringToFile( const String& strPath, const String& str )

#ifdef SPRITESTUDIO_GODOT_EXTENSION
Ref<FileAccess> 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;
}

Expand Down Expand Up @@ -157,14 +143,9 @@ Variant GdIO::loadVariantFromFile( const String& strPath )

#ifdef SPRITESTUDIO_GODOT_EXTENSION
Ref<FileAccess> 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;
}

Expand Down Expand Up @@ -241,14 +222,10 @@ Error GdIO::saveVariantToFile( const String& strPath, const Variant& val )

#ifdef SPRITESTUDIO_GODOT_EXTENSION
Ref<FileAccess> 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;
}

Expand Down
Loading