-
-
Notifications
You must be signed in to change notification settings - Fork 98
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
copyFileTo creates subdirectory in target directory with target's name #105
Comments
You can override SimpleStorage/sample/src/main/java/com/anggrayudi/storage/sample/activity/MainActivity.kt Line 359 in 39c5994
|
Hi, |
Ok, I tried to write directly in the target directory and got a permission denied, even this folder has storage access (SimpleStorage.hasStorageAccess retruns true) It all work when I use instead of "data.m_localImportSourcePath" ("/storage/emulated/0/test") the corresponding Tree-Uri from the getPersistedUriPermissions result List The problem is to make the Tree-Uri from the getPersistedUriPermissions list comparable with the single tree uri from the picker result. I didn't find a nice way, so I compare both last segments of the uris. no idea wether there's another better solution. Sorry for wasting your time. Please close, if this is the wanted way to go. br |
Hi, this is a bug. I'll fix it in v1.5.2 |
As a temporary solution, please go ahead with DocumentFile source = DocumentFile.fromFile(sourceDBFile);
// Parameter requiresWriteAccess must be "true", because you're going to write files into it
DocumentFile targetFolder = DocumentFileCompat.fromFullPath(this, data.m_localImportSourcePath, DocumentFileType.ANY, true);
DocumentFileUtils.copyFileTo(source, ctx, targetFolder, null, new FileCallback()); |
Hi, |
Fixed in v1.5.2 |
Hi,
first let me thank you for this great library.
Library version: 1.5.1
OS version: [Android 12]
Device model: Realme 7
In my app the user can choose a file (mStorageHelper.openFilePicker()), after this the selected file is copied to the apps internal storage and user can edit it in the app. After editing the user can finish editing and copy back the file to the original place.
When I copy the file back from the apps storage to the original folder, the copyFile methode creates a subfolder in the target
If I try to copy to the targets parent I get the error "CANNOT_CREATE_FILE_IN_TARGET", of course I only have the permission for the "test" folder
How can I prevent this? Is this the intented behaviour?
Thx and best reagrds
Klaus
The text was updated successfully, but these errors were encountered: