radimitrov / CSharpShellApp

77 stars 18 forks source link

Request : Ability to open project in external hard drives (e.g. SDCARD) #348

Closed equin0X35 closed 2 months ago

equin0X35 commented 7 months ago

it could be better if the a support external storage. is this possible? if so, why not?

radimitrov commented 7 months ago

Possible? Yes, with limits. Not via System.IO file access due to Google niceness - Android >= 11 scoped storage. Manage external storage app permission isn't an option. That means the app would only have access to external storage via slow Android IPC Intent calls. This doesn't easily include user code, however. And doesn't apply at all to your package dependencies that use a path.

I can modify the entire IDE's file logic to abstract over System.IO or AndroidX.DocumentFile and circumvent in the few places that doesn't work. This means that projects opened in this manner won't have working System.IO in external storage even though they are located there and their current directory will be changed to the app one.

And I'm not sure how much slower IO operations will be when System.IO can't be used. Possibly between 5 to 50 times. It will be noticeable at times.

equin0X35 commented 7 months ago

i see, accessing file in the external storage might be slower. I dont really have any a knowledge of it, but, it gain access to the sdcard using AndroidX.DocumentFile and use System.IO for io operations. However, seeing the io operation performace decreases is not good.

radimitrov commented 6 months ago

Yes, in reality I don't know how much slower it will be. Depends on the complexity of file operations. Should barely be noticeable in most cases like saving files even if you know exactly what to look for. For example the project loading/reloading stage will be affected most. If it takes say 0.1s normally (after JIT) then it might be ~1s in external storage.

However ultimately you are right that supporting external storage projects is good in general. I will probably start implementing it sometime in January.

radimitrov commented 4 months ago

I will finally be able to start implementing this within a few days. Could take anywhere from 3 weeks to over 2 months depending on issues along the way and time. Hopefully less and not more.

There will be an update here again when the storage wrapper is fully functional and I begin integration with the app. And another one when that is finished and tested.

The end result will still work under scoped storage for external storage. However in the file manager/picker UI that will be abstracted to a drop down list with the ability to add new root folders. Note that Android doesn't allow the storage root to be used so there are still a few inconvenient limits since folders will have to be added one by one or have the same parent folder.

I'm also pinning this issue to act as a sort of an announcement.

radimitrov commented 4 months ago

I'm going to have to push the few days start a bit more, at least until this new priority issue is fixed

radimitrov commented 2 months ago

Life stuff happened and I wasn't really able to work on this as intended. However I did implement support for "MANAGE_EXTERNAL_STORAGE" permission - check the top of the file manager or project open window. It looks like Google approved the update 2 days ago. Hopefully they won't revoke this. For now there won't be SD card support for working with projects directly - only the device internal storage. I'm considering this issue solved and closing it along with #325 #344 #325 #292