@@ -32,10 +32,10 @@ func install_or_update_formatter() -> void:
3232
3333
3434func _on_request_completed (
35- _http_result : int ,
36- response_code : int ,
37- _http_headers : PackedStringArray ,
38- body : PackedByteArray ,
35+ _http_result : int ,
36+ response_code : int ,
37+ _http_headers : PackedStringArray ,
38+ body : PackedByteArray ,
3939) -> void :
4040 if response_code != 200 :
4141 var error_message := "HTTP request failed. Response code: " + str (response_code )
@@ -78,11 +78,7 @@ func _process_response_latest_release(body: PackedByteArray) -> void:
7878 installation_failed .emit (error_message )
7979 return
8080
81- print (
82- "Found compatible release, starting download...\n " ,
83- "Download URL: " ,
84- download_url ,
85- )
81+ print ("Found compatible release, starting download...\n " , "Download URL: " , download_url )
8682
8783 http_request_state = HttpRequestState .DOWNLOADING_BINARY
8884 http_request .request (download_url )
@@ -109,12 +105,7 @@ func _process_response_download_file(body: PackedByteArray) -> void:
109105 return
110106
111107 print (
112- "\n " .join (
113- [
114- "GDScript formatter installed successfully!" ,
115- "Binary location: " + binary_path ,
116- ],
117- ),
108+ "\n " .join (["GDScript formatter installed successfully!" , "Binary location: " + binary_path ]),
118109 )
119110 installation_completed .emit (binary_path )
120111
@@ -124,7 +115,10 @@ func _get_platform_info() -> Dictionary:
124115 var processor_name := OS .get_processor_name ().to_lower ()
125116 var architecture := "x86_64"
126117
127- if processor_name .contains ("aarch64" ) or processor_name .contains ("arm64" ) or processor_name .contains ("apple" ):
118+ if (
119+ processor_name .contains ("aarch64" ) or processor_name .contains ("arm64" )
120+ or processor_name .contains ("apple" )
121+ ):
128122 architecture = "aarch64"
129123 elif processor_name .contains ("x86_64" ) or processor_name .contains ("amd64" ):
130124 architecture = "x86_64"
@@ -133,10 +127,7 @@ func _get_platform_info() -> Dictionary:
133127 if os_name .contains ("windows" ):
134128 binary_name = "gdscript-formatter.exe"
135129
136- var platform_info := {
137- "architecture" : architecture ,
138- "binary_name" : binary_name ,
139- }
130+ var platform_info := { "architecture" : architecture , "binary_name" : binary_name }
140131
141132 if os_name .contains ("windows" ):
142133 platform_info ["os" ] = "windows"
@@ -153,7 +144,11 @@ func _find_matching_asset(assets: Array, tag: String) -> String:
153144 if platform_info .is_empty ():
154145 return ""
155146
156- var expected_pattern := "gdscript-formatter-%s -%s -%s " % [tag , platform_info ["os" ], platform_info ["architecture" ]]
147+ var expected_pattern := "gdscript-formatter-%s -%s -%s " % [
148+ tag ,
149+ platform_info ["os" ],
150+ platform_info ["architecture" ],
151+ ]
157152 if platform_info ["os" ] == "windows" :
158153 expected_pattern += ".exe"
159154 expected_pattern += ".zip"
@@ -229,15 +224,14 @@ func _download_and_install_binary(zip_data: PackedByteArray, platform_info: Dict
229224 if not OS .get_name ().to_lower ().contains ("windows" ):
230225 # This should be equivalent to setting the binary to permissions 755
231226 const UNIX_EXECUTABLE_PERMISSIONS = (
232- FileAccess .UNIX_READ_OWNER
233- | FileAccess .UNIX_WRITE_OWNER
234- | FileAccess .UNIX_EXECUTE_OWNER
235- | FileAccess . UNIX_READ_GROUP
236- | FileAccess .UNIX_EXECUTE_GROUP
237- | FileAccess . UNIX_READ_OTHER
238- | FileAccess . UNIX_EXECUTE_OTHER
227+ FileAccess .UNIX_READ_OWNER | FileAccess . UNIX_WRITE_OWNER
228+ | FileAccess .UNIX_EXECUTE_OWNER | FileAccess . UNIX_READ_GROUP
229+ | FileAccess .UNIX_EXECUTE_GROUP | FileAccess . UNIX_READ_OTHER | FileAccess . UNIX_EXECUTE_OTHER
230+ )
231+ var permissions_error := FileAccess .set_unix_permissions (
232+ binary_path ,
233+ UNIX_EXECUTABLE_PERMISSIONS ,
239234 )
240- var permissions_error := FileAccess .set_unix_permissions (binary_path , UNIX_EXECUTABLE_PERMISSIONS )
241235 if permissions_error != OK :
242236 push_error ("Failed to make formatter executable: " , binary_path )
243237 DirAccess .remove_absolute (binary_path )
0 commit comments