How do you check if a file exists?

Hi, good morning.

Is there anyway to check if a file exists on a specific folder?

Best Regards,
Rui

@Taifun 's file extension provides exists block that checks whether a file or directory exists

Image taken from Puravida Apps

image

2 Likes

Yes, but he says:

Tested with Android 11 on the test server (targetSdk=30), Companion & APK:

3 Likes

If that's your concern then I don't say any such thing about FileTools :wink:

2 Likes

@Taifun I don't think so.

I think most of the methods and events will still work, except copying files to the external storage (outside the ASD) on devices with Android ā‰„ 10, because WRITE permission does no longer exist (with targetSdk = 30).

But DefaultFileScope must be set to Legacy (otherwise you will not be able to ask for READ / WRITE permissions for Android versions from 4.4 - 9, API 19 - 28).

grafik

See also here:

1 Like

Means ...?
I think the same (what I've tried to explain) is also true for your FileTools extension.

I mean I haven't tested it with max sdk 30 so I can't make any statement about that.

However,

1 Like

Yes, exactly. The same applies to the (new) File component.
So, like I said, most of the methods and events will still work ...

2 Likes

you are correct, as always :wink:

however the purpose of an extension is to provide functionality, which is not possible with built in components... and as the file component starting with the coming release is able to copy, delete etc. itself, my suggestion is to use the file component then...

Taifun

2 Likes

Yes, but

  1. There are some methods that the File component does not offer.

  2. The use of your extension is familiar to most users, which is definitely not the case with the new File component.


    On top of that there is one more setting in the designer:
    grafik
    which defines the API from which READ / WRITE permissions are declared in the Manifest.

  3. I need e.g. the method TaifunFile.CopyAsync and the corresponding event (TaifunFile.Copied) to carry out certain actions there. This is not possible with the File component.

  4. The same applies for some other methods.

Therefore your extension is still useful and helpful. And the same applies to the FileTools extension from @vknow360.

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.