massivemadness / Squircle-CE

👨‍💻 Squircle CE is a fast and free multi-language code editor for Android
https://play.google.com/store/apps/details?id=com.blacksquircle.ui
Apache License 2.0
1.38k stars 101 forks source link

Can't create files from the explorer panel #194

Closed xparq closed 1 year ago

xparq commented 1 year ago

Please consider making a Pull Request if you are capable of doing so.

App Version: 2023.1.4

Affected Device(s):

Huawei Mate 10 Pro (not rooted) with Android 10.0 (+ MEUI 10, and Microsoft Launcher(?))

Description

Right after a fresh install (today), and opening it the first time, it consistently failed to create any new files from its file explorer / folder selector tool, for some strange reason.

Storage perm. granted, "Documents" folder selected (or same with "Downloads"), default "untitled.txt" (or any other name/ext. I tried): "An error occured"...

Some more detailed error message also seemed to pop up right beforehand, but it always disappeared immediately, so I had no chance reading or capturing that.

Other apps could of course write there just fine.

This app could still open those files created with something else, and then Save works just fine. Moreover, even Save As, or New works, too, from inside the editor's File menu, so it seems the problem is (fortunately) confined to the "explorer" tool.

massivemadness commented 1 year ago

Hi @xparq, the only validation for filename is isNotEmpty() && !contains("/") && !equals(".") && !equals(".."). It looks like you're getting an error thrown by the android framework 🥴 I need some time to investigate this, thanks for reporting

xparq commented 1 year ago

Hey @massivemadness, thanks for checking!

Very bizarre indeed, I have zero idea what could interfere there.

xparq commented 1 year ago

BTW, tested again, and updated the report -- I misremembered the error message, and probably confused you with that a bit, sorry.

I was quite unfocused yesterday and got confused myself by the filename placeholder "untitled.txt": since it looks like one, my half brain (the other half was trying to steal some sleep I guess) interpreted it really as a default filename, which it isn't, and when I didn't enter anything, I falsely assumed that it would be called untitled.txt. Also amplified my false assumption that it's indeed a common case in general to use such a name by default when the user doesn't supply any.

So, for a slightly smoother ergonomics experience (i.e. to help my fellow sleep-deprived and/or ADD-ridden zombie users submit more accurate reports in the future :) ), it would be nice if you could consider a) either changing the placeholder to not look like a strongly plausible default value (but rather a hint, like "Enter filename"), or b) actually applying that untitled.txt as the default name indeed, or c) you could just remove the (basically redundant) placeholder altogether.

So, anyway, the "Invalid filename" error was a red herring, and the real error is still unknown.