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

In Godot 3.3.2, scripts cannot use rename() to change folder names #48254

Closed
yxl1779556215 opened this issue Apr 28, 2021 · 16 comments · Fixed by #51793
Closed

In Godot 3.3.2, scripts cannot use rename() to change folder names #48254

yxl1779556215 opened this issue Apr 28, 2021 · 16 comments · Fixed by #51793

Comments

@yxl1779556215
Copy link

yxl1779556215 commented Apr 28, 2021

Godot version:

3.3.2

OS/device including version:

windows10

Issue description:

Steps to reproduce:

Minimal reproduction project:

Godot 3.3中无法使用rename对文件夹进行重命名,但是对文件可以。对文件夹进行重命名时,系统报错为:file_exists()所选文件不存在。本人推测是将文件夹作为文件进行判断,我对Godot进行卸载重装,依然是这样。在3.2.3版本中没有出现这个错误

@Megalomaniak
Copy link

Translation via google translate:
"In Godot 3.3, rename cannot be used to rename folders, but files can be renamed. When renaming the folder, the system reports an error: The file selected by file_exists() does not exist. I guessed that the folder was judged as a file. I uninstalled and reinstalled Godot, and it was still the same. This error did not appear in version 3.2.3"

@akien-mga akien-mga changed the title 在Godot3.3版本中无法使用rename()函数对文件夹进行重命名 Can't rename folder in FileSystem dock since Godot 3.3 Apr 28, 2021
@akien-mga
Copy link
Member

I can't reproduce the issue, renaming folders works fine here on Linux:

simplescreenrecorder-2021-04-28_10.03.43.mp4

Please give more details. What OS are you using? What are you doing exactly?

@floppyhammer
Copy link
Contributor

能提供一个可以复现这个问题的Godot工程(打成压缩包再拖进评论框就行)吗?还有,最好提供一些其它的信息,比如你的操作系统之类的(按照模板来填,查查你的问题上面那几个小标题什么意思)。另外,这个社区一般用英语交流,你可以先自己用谷歌翻译转成英语,这样也省得麻烦别人特地去转。

Can you provide a minimal reproduction project? And it's better to give more details about the issue, e.g. the OS you're using. In addition, English is mostly used for communication in this community. I suggest you translate your words into English by Google Translate first, saving some trouble for others.

@Megalomaniak
Copy link

Megalomaniak commented Apr 28, 2021

Can't reproduce on windows 7 64 bit either. Using an administrative account though. Godot 3.3 64bit(didn't try the mono version).

@Calinou
Copy link
Member

Calinou commented May 15, 2021

@yxl1779556215 Can you still reproduce this bug? You can also test this in Godot 3.3.1rc2 and see if you can reproduce the bug there.

@yxl1779556215
Copy link
Author

@yxl1779556215你还能重现这个虫子吗?您也可以在Godot 3.3.1rc2中测试此,看看是否可以在那里重现该 bug。

Sorry, I don't know much about GitHub. I am using windows10 and godot version 3.3.2. This error still exists, please help me, thank you.
屏幕截图 2021-08-17 141810
屏幕截图 2021-08-17 142040

@floppyhammer
Copy link
Contributor

What the docs say about this method:

Error rename ( String from, String to )

Renames (move) the from file to the to destination. Both arguments should be paths to files, either relative or absolute. If the destination file exists and is not access-protected, it will be overwritten.

Returns one of the Error code constants (OK on success).

It can only be used to change files' name, so what you're experiencing is intended.

@yxl1779556215
Copy link
Author

文档对此方法的看法:

错误重命名 (字符串从, 字符串到 )
将文件重命名为到目的地。这两种参数都应是通往文件的路径,无论是相对的还是绝对的。如果目的地文件存在且未受访问保护,则将被覆盖。
返回错误代码常数之一(成功时确定)。

它只能用于更改文件的名称,因此您正在体验的内容是有意的。

Thank you for your answer, but in my version 3.2.3, this behavior is feasible.

@floppyhammer
Copy link
Contributor

floppyhammer commented Aug 17, 2021

@yxl1779556215 Just did some testing. Can confirm that Directory.rename() in 3.3 and 3.4 can't rename folders while it can in 3.2.3. We should change the issue title.

@yxl1779556215
Copy link
Author

@yxl1779556215 Just did some testing. Can confirm that Directory.rename() in 3.3 and 3.4 can't rename folders while it can in 3.2.3. We should change the issue title.

Thank you very much for your reply. I don't know how the title got there. I don't know much about it. Is there a way to rename folders using scripts in Version 3.3.2?

@floppyhammer
Copy link
Contributor

@yxl1779556215 Sorry I couldn't think of a straightforward way to do it. If this change is not intended, I'll try to look into the issue.

@floppyhammer
Copy link
Contributor

The behaviour change of rename() was introduced by 11cbe99 to avoid renaming a non-existing file. Since a path is not a valid file, ERR_DOES_NOT_EXIST gets returned.

@yxl1779556215
Copy link
Author

11cbe99引入了行为更改,以避免重命名不存在的文件。由于路径不是有效的文件,将返回。rename()``ERR_DOES_NOT_EXIST

HMM... I don't understand it, but it looks like that's where the problem is. So, what do I need to learn if I want to get involved in developing Godot?

@floppyhammer
Copy link
Contributor

@yxl1779556215 You could check out this page first https://docs.godotengine.org/en/stable/community/contributing/ways_to_contribute.html. And this specific issue will be handled by @KoBeWi.

@yxl1779556215
Copy link
Author

@yxl1779556215 You could check out this page first https://docs.godotengine.org/en/stable/community/contributing/ways_to_contribute.html. And this specific issue will be handled by @KoBeWi.

Thank you very much!

@KoBeWi
Copy link
Member

KoBeWi commented Aug 17, 2021

And this specific issue will be handled by @KoBeWi.

Even if an issue has someone assigned, you are free to make a PR, because there is no guarantee that it will be handled anytime soon.
Although in this case the fix was easy, so I could make a quick PR.

@yxl1779556215 yxl1779556215 changed the title Can't rename folder in FileSystem dock since Godot 3.3 In Godot 3.3.2, scripts cannot use rename() to change folder names Aug 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants