Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File.open_encrypted_with_pass() returns ERR_FILE_UNRECOGNIZED #32881

Open
vicguedez opened this issue Oct 16, 2019 · 4 comments
Open

File.open_encrypted_with_pass() returns ERR_FILE_UNRECOGNIZED #32881

vicguedez opened this issue Oct 16, 2019 · 4 comments

Comments

@vicguedez
Copy link

Godot version:
3.1.1.stable-official

OS/device including version:
Windows 7

Issue description:
If you try to read or write a file using File.open_encrypted_with_pass() it returns ERR_FILE_UNRECOGNIZED and doesn't say much more.

Windows cmd displays:

ERROR: open_and_parse: Condition ` magic != 0x43454447 ` is true. returned: ERR_FILE_UNRECOGNIZED
    At: core/io/file_access_encrypted.cpp:65

Steps to reproduce:

var file : File = File.new()
var open_result = file.open_encrypted_with_pass("user://user.json", File.WRITE_READ, OS.get_unique_id())

print("Open result ", open_result)
@fsy98
Copy link
Contributor

fsy98 commented Oct 22, 2019

I try your reproduce in my laptop is window10, and it have another problem, So I think may could change the way to read and write the file, for example:

func save(content):
    var file = File.new()
    file.open("user://save_game.dat", File.WRITE)
    file.store_string(content)
    file.close()

Here is the link I found,I hope this will help you https://docs.godotengine.org/en/3.1/classes/class_file.html

@KoBeWi
Copy link
Member

KoBeWi commented Oct 25, 2020

Still valid in 3.2.3
Looks like open_encrypted_with_pass() doesn't support WRITE_READ mode, not sure if it's intended.

@venilark
Copy link

Still happens in 4.0-beta13 with the new FileAccess API.

@MatiasVME
Copy link

MatiasVME commented Feb 8, 2024

Still happens in versions 4.2.1 and 4.2.2 and 4.3-beta3

The file is supposed to be created if I do the following:

extends Node2D


func _ready():
	var _file_path := "user://my_file.save"
	
	var file = FileAccess.open_encrypted_with_pass(
		_file_path,
		FileAccess.WRITE_READ,
		"123456"
	)
	var _error = FileAccess.get_open_error()
	var content = file.get_var()
	file.close()

imagen

I am using:
Godot Engine v4.2.1.stable.arch_linux - https://godotengine.org
OpenGL API 4.6 (Core Profile) Mesa 23.3.3-manjaro1.1 - Compatibility - Using Device: Intel - Mesa Intel(R) UHD Graphics (CML GT2)

Minimal Example:
ERR_FILE_UNRECOGNIZED.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants